#include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long int ll; typedef pair P; vector prime; bool isprime[1000000]; void sieve(){ for(ll i=0; i<1000000; i++){ isprime[i]=1; } isprime[0]=0, isprime[1]=0; for(ll i=2; i<1000000; i++){ if(isprime[i]){ prime.push_back(i); for(ll j=2*i; j<1000000; j+=i){ isprime[j]=0; } } } return; } ll mulmod(ll a, ll b, ll m){ ll x=1000000000; if(m0){ if(k%2==1){ ans=mulmod(ans, ap, m); } ap=mulmod(ap, ap, m); k/=2; } return ans; } bool is_prime(ll n){ if(n==2){ return true; } if(n==1 || n%2==0){ return false; } ll d=n-1; int k=0; while(d%2==0){ d/=2; k++; } random_device rnd; mt19937_64 mt(rnd()); uniform_int_distribution rndn(2, n-1); for(int i=0; i<50; i++){ ll a=rndn(mt); bool comp=1; ll ap=powmod(a, d, n); if(ap==1 || ap==n-1) continue; for(int r=1; r>q; sieve(); for(int i=0; i>n; if(n<=3){ cout<<"No"<