1 tc giving wa in Deepak and Primes ques

my sol : https://ide.codingblocks.com/s/241031

ques: https://hack.codingblocks.com/app/contests/1463/222/problem

sieve can only generate primes <= 1000000 and i m not able to find out how to find primes >=1000000 and <=5000000

i think thats why 1 tc is giving wa

pls help