DIVSUM2-SPOJ

QUESTION:click here
I know it can be calulated by formula( p1^(e1+1)-1)/(p1-1)*( p2^(e2+1)-1)/(p2-1)…(p-prime,e-pow)
but N is 1e16 so classical seive or calculating least prime factor using seive will not work.
if any one know any other way using seive please share here…??