var
n : longint;
i, j : integer;
a : array [2..9] of integer;
f1, f2 : text;
begin
assign(f1,'input.txt'); reset(f1);
assign(f2,'output.txt'); rewrite(f2);
read(f1,n);
for i:=2 to 9 do a[i]:=0;
for i:=9 downto 2 do
while n mod i=0 do
begin a[i]:=a[i]+1; n:=n div i end;
if n>1 then write(f2,0)
else for i:=2 to 9 do
for j:=1 to a[i] do write(f2,i);
close(f2)
end.
n : longint;
i, j : integer;
a : array [2..9] of integer;
f1, f2 : text;
begin
assign(f1,'input.txt'); reset(f1);
assign(f2,'output.txt'); rewrite(f2);
read(f1,n);
for i:=2 to 9 do a[i]:=0;
for i:=9 downto 2 do
while n mod i=0 do
begin a[i]:=a[i]+1; n:=n div i end;
if n>1 then write(f2,0)
else for i:=2 to 9 do
for j:=1 to a[i] do write(f2,i);
close(f2)
end.