#include #include #include #include #include #include #include using namespace std; #define REP(i,n) for(int i=0;i<(n);++i) #define FOR(i,a,b) for(int i=(a);i<=(b);++i) #define RFOR(i,a,b) for(int i=(a);i>=(b);--i) typedef long long LL; vector split( const string& s, const string& delim =" " ) { vector res; string t; for ( int i = 0 ; i != s.size() ; i++ ) { if ( delim.find( s[i] ) != string::npos ) { if ( !t.empty() ) { res.push_back( t ); t = ""; } } else { t += s[i]; } } if (!t.empty() ) { res.push_back(t); } return res; } vector splitInt( const string& s, const string& delim =" " ) { vector tok = split( s, delim ); vector res; for ( int i = 0 ; i != tok.size(); i++ ) res.push_back( atoi( tok[i].c_str() ) ); return res; } LL gcd(LL a,LL b){ return b?gcd(b,a%b):a; } inline LL lcm(LL a,LL b){ return a/gcd(a,b)*b; } int s2i(string s) { stringstream ss; ss << s; int res; ss >> res; return res; } string i2s(int n) { stringstream ss; ss << n; string res; ss >> res; return res; } bool isprime(int n) { if (n == 1) return false; if (n == 2 || n == 3 || n == 5 || n == 7) return true; int mid = (int) sqrt(n + 0.0); for (int i = 3; i <= mid; i += 2) { if (n % i == 0) return false; } return true; } void run() { int n = 0, s = 1, m = 1; for (int i = 2; ; i += 2) { REP(j,4) { s += i; if (isprime(s)) ++n; } m += 4; if (n * 10 < m) { cout << i + 1 << endl; return; } } } int main() { run(); }