Const Fi='NTDX.INP';
Fo='NTDX.OUT';
Var f,g: text;
n: longint;
Function ngto(a: longint): boolean;
Var i: longint;
Begin
If a<2 then exit(false);
For i:=2 to a div 2 do
If a mod 2 = 0 then exit(false);
Exit(true);
End;
Function dx(a: longint): boolean;
Var b,s: longint;
Begin
b:=a; s:=0;
While a<>0 do
Begin
s:=s*10+a mod 10;
a:=a div 10;
End;
If a=s then exit(true);
exit(false);
End;
Begin
Assign(f,Fi); Reset(f);
Assign(g,Fo); Rewrite(g);
Read(f,n);
If (ngto(n)) and (dx(n)) then Write(g,'Ngto doi xung')
Else Write(g,'Khong phai ngto doi xung');
Close(f);
Close(g);
End