{
TASK:n23
LANG:PASCAL
}
program n23;
label 1;
var k,q,n,j:integer;
    i,s1,s:longint;
    a:string;
begin
readln(n);
if (1<=n)and(n<=10000) then else begin
   writeln('Greshka 1<=n<=10000');
   halt;
end;
s:=1;
for i:=1 to n do s:=s*2;
s1:=s;
q:=0;
repeat
begin
j:=0;
str(s1,a);
for i:=1 to length(a) do if (a[i]='2')or(a[i]='3') then else j:=1;
if j=1 then goto 1;
if (s1 mod s=0) then begin
   writeln(s1);
   q:=1;
   halt;
end;
1:
s1:=s1+1;
end;
until (q=1)or(s1>1073741824);
writeln('NO');
end.