// PascalABC.Net
var n: integer;
o: string;
begin
n := 10000;
o := '';
while n >= 8 do
o := (n mod 8) + o;
n := n div 8;
end;
o := n + o;
writeln(o);
end.
// PascalABC.Net
var n: integer;
o: string;
begin
n := 10000;
o := '';
while n >= 8 do
begin
o := (n mod 8) + o;
n := n div 8;
end;
o := n + o;
writeln(o);
end.