#include<bits/stdc++.h>
using namespace std;
bool hw(int x){
bool r=false;
int g=x%10;
int s=x%100/10;
int b=x/100;
if(g*100+s*10+b==x) r=true;
return r;
}
bool zs(int n){
bool c=true;
if(n<2) c=false;
else{
for(int j=2;j<=sqrt(n);j++){
if(n%j==0){
c=false;
break;
}
}
}
return c;
}
int main(){
//cout<<hw(121);
cout<<"11"<<endl;
for(int i=100;i<1000;i++){
if(zs(i)&&hw(i)) cout<<i<<endl;
}
return 0;
}
/**************************************************************
Problem: 1142
User: hongjiaming
Language: C++
Result: Accepted
Time:4 ms
Memory:2072 kb
****************************************************************/