#include <iostream>
#include <vector>
using namespace Std;
int main () {
int n;
while (Cin>>n) {
Vector<int> VEC;
int num = 0;//num is used to record how many eligible primes are in the 1~n, in fact only 0 and not 0 difference
for (int i=11; i<n; i++) {
int flag = 0;//flag is intended to determine whether an integer i is a prime number, if it is a prime number flag=1, otherwise flag=0
for (int k=2; k<i/2+1; k++) {//If the criterion is k<sqrt ((double) i), the result is incorrect
Once except to prove that I is not a prime, I can be judged next
if (i%k = = 0) {
Flag = 0;
Break
}
If not done, continue the loop
else {
flag = 1;
Continue
}
}
if (flag = = 0) {//I is not a prime number
Continue
}
else {//I is a prime number
if (i%10 = = 1) {//I's bits are 1
Vec.push_back (i);
num = num + 1;
Continue
}
else {//i bits are not 1
Continue
}
}
}
if (num = = 0) {
cout<< "-1" <<endl;
}
else {
for (int m=0; m<vec.size ()-1; m++) {
cout<<vec[m]<< "";
}
Cout<<vec[vec.size () -1]<<endl;
}
}
return 0;
}
Nine degrees oj--1163 (c + +)