#include <iostream>
using namespace std;
bool prim(int n)
{
if (n <= 1)
{
return false;
}
else
{
for (int i = 2; i <= n / 2; i++)
{
if (n % i == 0)
{
return false;
break;
}
}
}
return true;
}
int sumCif(int n)
{
int s = 0;
while (n != 0)
{
int c = n % 10;
s += c;
n = n / 10;
}
return s;
}
int main()
{
for (int i = 2; i <= 100000; i++)
{
if (prim(i) && sumCif(i) == 13)
{
cout << i << " ";
}
}
return 0;
}