uses crt;
var a:array[1..100]of integer;
n,i,k,t:integer;
begin
clrscr;
repeat
write('nhap n='); readln(n);
until (0<n) and (n<=100);
for i:=1 to n do
begin
repeat
write('a[',i,']='); readln(a[i]);
until abs(a[i])<=300;
end;
write('nhap k='); readln(k);
t:=0;
for i:=1 to n do
if a[i] mod k=0 then t:=t+a[i];
writeln('Tong cac so la boi cua ',k,' trong day la: ',t);
readln;
end.