Const n=10;
var a:array[1..n]of integer;
i,k,l,aa: integer;
begin
for i:=1 to n do readln(a[i]);
for i:=1 to n do
if (a[i] mod 11 =0) and (a[i]<1000) and(a[i]>99) then
begin
k:=0;
aa:=a[i];
for i:=1 to 3 do
begin
l:=aa mod 10;
if l=3 then k:=1;
aa:=aa div 10;
end;
if k=1 then writeln(a[i]);
end;
end.