uses crt;
type mang=array[1..100]of integer;
var i,n,t:integer;
a:mang;
{------------------------chuong-trinh-con-nhap--------------------------}
procedure nhap;
begin
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
end;
{------------------------chuong-trinh-con-tinh-boi-cua-5--------------------}
function ktra(x:integer):boolean;
begin
if x mod 5=0 then ktra:=true
else ktra:=false;
end;
{------------------------chuong-trinh-chinh----------------------------}
begin
clrscr;
nhap;
t:=0;
for i:=1 to n do
if ktra(a[i])=true then t:=t+a[i];
writeln(t);
readln;
end.