90分求调……
#include<bits/stdc++.h>
using namespace std;
int n,m,an[10009],l=1;
int up_to_down(int y){
int i=1,j=1,ans=0,now;
while(y/i!=0) i*=10;
i/=10;
while(i!=0){
now=y;
now%=i*10;
now/=i;
ans+=now*j;
j*=10;
i/=10;
}
return ans;
}
bool IF(int x){
if(x==1||x==0) return 0;
for(int i=2;i<x;i++) if(x%i==0) return 0;
return 1;
}
int main(){
cin>>n>>m;
for(int i=n;i<=m;i++){
if(IF(i)==1&&IF(up_to_down(i))==1){
an[l]=i;
l++;
}
}
for(int i=1;i<l;i++){
if(i==l-1) cout<<an[i];
else cout<<an[i]<<",";
}
return 0;
}