var a, b, c, n, i :integer;
s: array [1..30] of integer;
begin
for i:=1 to 30 do
read (s[i]);
for i:=1 to 30 do
if s[i] div 1000 = 0 then a:=s[i];
if a=0 then write ('No') else
for i:=1 to 30 do
if (s[i] div 1000 = 0) and (a>s[i]) then a:=s[i];
write (a);
end.