#include<bits/stdc++.h>
using namespace std;
bool zh(int n)
{
for(int i=2;i<n;i++)
{
if(n%i==0)
{
return 0;
}
}
return 1;
}
bool zss(int n)
{
if(zh(n))
{
string t=to_string(n);
reverse(t.begin(),t.end());
n=stoi(t);
if(zh(n))
{
return 1;
}
}
return 0;
}
int main(){
int n,m;
cin>>n>>m;
int j=n;
for(int i=n;i<=m;i++)
{
if(zss(i))
{
if(j>n)
{
cout<<","<<i;
}
else
{
cout<<i;
}
j++;
}
}
return 0;
}