Program n1_3;
var a, s:integer;
begin;
read(a);
while a<>0 do begin;
if (a mod 6 = 0) and (a mod 10 = 2) then s+=a;
read(a);
end;
write(s);
end.
program n1_6;
var a, s:integer;
begin;
read(a);
while a<>0 do begin;
if (a mod 8 = 0) and (a <= 99) and(a >= 10) then s+=a;
read(a);
end;
write(s);
end.