//PascalABC.Net;
//(c) NaaMan;
var
s, k : integer;
begin
k := 1;
for var i := 1000 to 9999 do begin
s := 0;
for var j := 0 to 3 do begin
s += (i div round(power(10, j)) mod 10)
end;
if (i mod s = 0) then begin
write(i, ' ');
if (k mod 4 = 0) then writeln;
k += 1
end
end
end.