import math
def f(n):
m=int(math.sqrt(n))
return [i for i in range(1,m+(m*m < n))]+[n/i for i in range(m,0,-1)]
a={}
tick=2000
for i,j in enumerate(f(10**10)):
c=f(j)
a[j]=(pow(3,j+1,10**10)/2-pow(2,j+1,10**10)+1-sum(((c[-u-1]-c[-u-2])*a[c[u]])%(10**9) for u in range(len(c)-1)))%(10**9)
if i%tick==0:print i/tick,"percent completed"
print a[10**10]%(10**9)