using namespace std;

int main()

{

int a, rev = 0, c = 0,temp,i;

cin>>a

;

for(; c=0; a++)

{

int b = sqrt(a);

for(i = 2; i<=b; i++)

```
{
if((a%i)!=0)
{
temp=a;
while(temp!=0)
{
int r = temp%10;
```

rev = rev*10 + r ;

temp = temp/10;

}

```
}
if(rev == a)
{
cout<<rev<<"\n";
```

c=1;

}

```
}
```

}

return 0 ;

}