program chia_het_2_5;
uses crt;
var A:array[1..1000] of integer;
n,i,t,t2,t5:integer;
begin
clrscr;
write('Nhap N: '); readln(n);
t:=0;
for i:=1 to n do
begin
write('Nhap so thu ',i,': '); readln(A[i]);
if A[i] mod 2=0 then t2:=t2+A[i];
if A[i] mod 5=0 then t5:=t5+A[i];
if (A[i] mod 2=0) and (A[i] mod 5=0) then t:=t+A[i];
end;
writeln('Tong cac so chia het cho 2 la: ',t2);
writeln('Tong cac so chia het cho 5 la: ',t5);
writeln('Tong cac so vua chia het cho 2, vua chia het cho 5 la: ',t);
readln;
end.