var s,a:string; n:qword; i:longint;
function nt(a:longint):boolean;
var i:longint;
begin
if a>1 then nt:=true else nt:=false;
for i:=2 to trunc(sqrt(a)) do
if a mod i=0 then nt:=false;
end;
begin
readln(n);
if (n>9)and(nt(n)) then writeln(0) else
begin
i:=9;
repeat
while n mod i<>0 do dec(i);
while (n mod i=0)and(n<>1) do begin n:=n div i; str(i,a); s:=s+a; end;
if (i=0)and(n<>0) then i:=9;
until n=1;
for i:=length(s) downto 1 do write(s[i]);
end;
end.