#include #pragma GCC target("avx") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") using namespace std; #define lli long long int #define uli unsigned long long int #define INF 9999999999 #define rep(i,m,n) for(lli i = m;i < n;i++) #define rrep(i,m,n) for(lli i=m-1;i>=n;i--) #define pb(n) push_back(n) #define UE(N) N.erase(unique(N.begin(),N.end()),N.end()); #define Sort(n) sort(n.begin(), n.end()) #define Rev(n) reverse(n.begin(),n.end()) #define Out(S) cout << S << endl #define NeOut(S) cout << S #define HpOut(S) cout << setprecision(25) << S << endl #define Vec(K,L,N,S) vector K(N,S) #define DV(K,L,N,M,S) vector> K(N,vector(M,S)) #define TV(K,L,N,M,R,S) vector>> K(N,vector>(M,vector(R,S))) #define pint pair #define paf(L,R) pair #define mod 998244353 #define MAX 10000000 #define ALL(a) a.begin(),a.end() #define chmax(a, b) a = (((a)<(b)) ? (b) : (a)) #define chmin(a, b) a = (((a)>(b)) ? (b) : (a)) vectorprime_table(int n){ vectorprime(n+1,1); if(n>=0)prime[0]=0; if(n>=1)prime[1]=0; for(int i=2;i*i<=n;i++){ if(!prime[i])continue; for(int j=i+i;j<=n;j+=i){ prime[j]=0; } } return prime; } long long modpow(long long n,long long k,long long m){ if(k==0)return 1; else if(k%2==1)return modpow(n,k-1,m)*n%m; else{ long long temp=modpow(n,k/2,m); return temp*temp%m; } } long long modinv(long long a, long long m) { long long b = m, u = 1, v = 0; while (b) { long long t = a/b; a -= t*b; swap(a, b); u -= t*v; swap(u, v); } u %= m; if (u < 0) u += m; return u; } //const int mod = 998244353; // to be set appropriately const long long PR = 3; // to be set appropriately void trans(vector &v, bool inv = false) { int n = (int)v.size(); for (int i = 0, j = 1; j < n-1; j++) { for (int k = n>>1; k > (i ^= k); k >>= 1); if (i > j) swap(v[i], v[j]); } for (int t = 2; t <= n; t <<= 1) { long long bw = modpow(PR, (mod-1)/t, mod); if (inv) bw = modinv(bw, mod); for (int i = 0; i < n; i += t) { long long w = 1; for (int j = 0; j < t/2; ++j) { int j1 = i + j, j2 = i + j + t/2; long long c1 = v[j1], c2 = v[j2] * w % mod; v[j1] = c1 + c2; v[j2] = c1 - c2 + mod; while (v[j1] >= mod) v[j1] -= mod; while (v[j2] >= mod) v[j2] -= mod; w = w * bw % mod; } } } if (inv) { long long inv_n = modinv(n, mod); for (int i = 0; i < n; ++i) v[i] = v[i] * inv_n % mod; } } vector NTT(vector A, vector B) { int size_a = 1; while (size_a < A.size()) size_a <<= 1; int size_b = 1; while (size_b < B.size()) size_b <<= 1; int size_fft = max(size_a, size_b) << 1; vector cA(size_fft, 0), cB(size_fft, 0), cC(size_fft, 0); for (int i = 0; i < A.size(); ++i) cA[i] = A[i]; for (int i = 0; i < B.size(); ++i) cB[i] = B[i]; trans(cA); trans(cB); for (int i = 0; i < size_fft; ++i) cC[i] = cA[i] * cB[i] % mod; trans(cC, true); vector res((int)A.size() + (int)B.size() - 1); for (int i = 0; i < res.size(); ++i) res[i] = cC[i]; return res; } int main(){ ios::sync_with_stdio(false); cin.tie(0); lli A,B,C,D,E,F,N,M,K,L,X,Y,Z,H,W,sum=0,num=0,flag=0;string S,T; cin >> N; auto P=prime_table(120000); num=1; Vec(IA,lli,1,1); rep(i,100001,120000){ if(num>N||N==1)break; if(P[i]){ Vec(IB,lli,0,0); A=i; while(A){ IB.pb(A%10); A/=10; } //Rev(IB); IA=NTT(IA,IB); A=IA.size(); rep(i,0,A){ if(IA[i]>9){ B=IA[i]/10; IA[i]%=10; if(i==A-1)IA.pb(B); else IA[i+1]+=B; } } num++; } } Rev(IA); for(auto v:IA)NeOut(v); Out(""); }