var x, sum, i, k:Integer;
begin
sum:=0;
readln(x);
for i := 1 to 30000 do
readln(k);
if k = 0 then
break;
end;
if k > x then
sum:=sum+k;
writeln(sum);
end.
var x, sum, i, k:Integer;
begin
sum:=0;
readln(x);
for i := 1 to 30000 do
begin
readln(k);
if k = 0 then
begin
break;
end;
if k > x then
begin
sum:=sum+k;
end;
end;
writeln(sum);
end.