CCCPaste
# a)

# dict1 = {1 : "One", 2 :"Two", 3 : "Three", 4 : "Four", 5 : "Five", 6 : "Six", 7 : "Seven", 8 : "Eight", 9 : "Nine"
#          , 10 : "Ten", 11 : "Eleven" , 12 : "Twelve" , 13 : "Thirteen", 14 : "Fourteen", 15 : "Fifteen",
#            16 : "Sixteen", 17 : "Seventeen" , 18 : "Eighteen", 19 : "Nineteen", 
#            20 : "Twenty", 30 : "Thirty", 40 : "Fourty", 50 : "Fifty", 60 : "Sixty", 70 : "Seventy", 80 : "Eighty",
#            90 : "Ninety"}

# for i in range(2,10):
#     for j in range(1,10):
#         num = (i*10)+j
#         name = dict1[i*10] + ' ' + dict1[j]
#         dict1.update({num : name})

# def hundredPart(s):
#     n = len(s)
#     if n <= 2:
#         return dict1[int(s)]
#     else:
#         ans = ""
#         if s[0] != '0':
#             ans = ans + dict1[int(s[0])] + " Hundred "
#         if int(s[1:3]) != 0:
#             ans = ans + dict1[int(s[1:3])]
#         return ans

# def thousandPart(s):
#     if int(s) != 0:
#         return hundredPart(s) + " Thousand"
#     return ""

# def millionPart(s):
#     if int(s) != 0:
#         return hundredPart(s) + " Million"
#     return ""

# def numberName(s):
#     n = len(s)

#     if int(s) == 0:
#         return "Zero"
    
#     if n<=3:
#         return hundredPart(s)
#     elif n<=6:
#         return thousandPart(s[0:n-3]) + ' ' + hundredPart(s[n-3:n])
#     elif n<=9:
#         return millionPart(s[0:n-6]) + ' ' + thousandPart(s[n-6:n-3]) + ' ' + hundredPart(s[n-3:n])
    
#     return "Out of range!!!"
        
# num = input("Enter a number in the range[0,999999999]: ")
    
# print(numberName(num))

dict1 = {"Zero": 0,"One" : 1, "Two" : 2, "Three" : 3,"Four" : 4,"Five" : 5,"Six" : 6,"Seven" : 7,"Eight" : 8,"Nine" : 9,
          "Ten" : 10,"Eleven" : 11,"Twelve" : 12,"Thirteen" : 13,"Fourteen" : 14,"Fifteen" : 15,"Sixteen" : 16,
          "Seventeen" : 17, "Eighteen" : 18,"Nineteen" : 19,"Twentey" : 20,"Thirty" : 30,"Fourty" : 40,"Fifty" : 50,
          "Sixty" : 60,"Seventy" : 70,"Eighty" : 80,"Ninety" : 90}

dict2 = {"Hundred" : 100,"Thousand" : 1000, "Million" : 1000000}

def wordNumber(s):
    words = s.split();
    num = 0
    ans = 0
    for word in words:
        if word in dict1:
            num = num + dict1[word]
        elif word in dict2:
            ans = ans + (num * dict2[word])
            num = 0
        else:
            return None
    
    ans = ans + num
    return ans

s = input("Enter a string: ")
print(wordNumber(s))