# Solve google challenge 02
# Sum of ten digit blocks from e that equal 49
#f(1)= 7182818284 
#f(2)= 8182845904 
#f(3)= 8747135266 
#f(4)= 7427466391 
#f(5)= __________ 

import real

def sumOfDigits(inNumber):
    #convert to string
    strNum = str(inNumber)

    sum = 0 #sum of all digits
    
    for digit in strNum[:]:
        sum = sum + int(digit)

    return sum

digits = 1000
e = real.e(digits) #compute e to n digits
strDigitsOfE = str(e)[2:-3] #Omit first 2 "2." and last 3 "+-2"


#Take every 10 digits and check for sum of 49
for startDigitPlace in range(digits-10): #can't select 10 digits from n-9th place 
    #select blocks of every 10 digits and check for sum of 49
    if (sumOfDigits(int(strDigitsOfE[startDigitPlace:startDigitPlace+10]))==49):
        print strDigitsOfE[startDigitPlace:startDigitPlace+10]," | Position: ",startDigitPlace