var a, sum, Count: integer;
begin
sum := 0;
Count := 0;
repeat
Read(a);
if Count mod 3 = 0 then sum += a;
Count += 1;
until a = 0;
Write(sum)
end.
var a, sum, Count: integer;
begin
sum := 0;
Count := 0;
repeat
Read(a);
if Count mod 3 = 0 then sum += a;
Count += 1;
until a = 0;
Write(sum)
end.