N=2**39L
term=[0L for i in range(0,10)]
Sum =[0L for i in range(0,10)]

# first term=1/2
term[1]=2**38L
# sum first two terms by hand
Sum[0]=2L; Sum[1]=2**38
# start with n=3
n=3
s=0
# multiple length division by n
while True:
    print s,n
    r=0
# r is remainder from previous division
    while True:
        a=r*N + term[s]
        term[s]=a/n
        print "div", s, hex(a/n)
        r=a%n
        if s>=9: break
        s=s+1

# add term to sum, starting with last digit
    t=10
    hexterm=[]
    for x in term: hexterm.append(hex(x))
    print hexterm
    hexsum=[]
    for x in Sum: hexsum.append(hex(x))
    print hexsum
    while True:
        M=term[t-1]
# forget about digits in term that are zero
        if M!=0:
            print "add", t, hex(M)
# set s place of last non-zero digit
            s=t
# set u to current place in addition
            u=t
# enter loop with carry digit until carry is zero
            c=0
            while True:
                M=M + c + Sum[u-1]
                Sum[u-1]=M%N
                c=M/N
                u=u-1
                M=0L
                if c==0: break
# move on to add next digit to sum
        t=t-1
        if t==0: break
    hexterm=[]
    for x in term: hexterm.append(hex(x))
    print hexterm
    hexsum=[]
    for x in Sum: hexsum.append(hex(x))
    print hexsum
# added with term, increment n
    n=n+1
    if n>100:1/0
# s has been set to place of last non-zero digit, decrement to get new start
    s=s-1
    if s>=9: break
#
# print result
#
for i in Sum:
    print hex(i)

tenten=10000000000L
print "2."
t=0
while True:
    K=Sum[9]
    s=9
    c=0
    while True:
        M=c+K*tenten
        K=Sum[s-1]
        Sum[s-1]=M/N
        a=M%N + Sum[s]
        Sum[s]=a%N
        if a>N: c=1
        else:   c=0
        s=s-1
        if s==0: break
    print Sum[0]
    t=t+1
    if t>=10: break

