var a:array[1..N] of integer;
s,K:integer;
begin
readln(K);
for i:=1 to N do readln(a[i]);
for i:=1 to N do
if (a[i] mod K=0) then s:=s+a[i];
write(s);
end.
var a:array[1..N] of integer;
s,K:integer;
begin
readln(K);
for i:=1 to N do readln(a[i]);
for i:=1 to N do
if (a[i] mod K=0) then s:=s+a[i];
write(s);
end.