def func(array):
  loc = 0
  while(array[loc] != 99):
    if(array[loc] == 1):
      array[array[loc+3]] = array[array[loc+1]] + array[array[loc+2]]
    elif(array[loc] == 2):
      array[array[loc+3]] = array[array[loc+1]] * array[array[loc+2]]
    else:
      print("how did that happen")
      exit()
    loc += 4
  # print(array)
  return array[0]


result = 0
noun = 0
verb = -1

while (result != 19690720):
  verb += 1
  if (verb > 99):
    noun += 1
    verb = 0
  seq = [1,noun,verb,3,1,1,2,3,1,3,4,3,1,5,0,3,2,10,1,19,2,19,6,23,2,13,23,27,1,9,27,31,2,31,9,35,1,6,35,39,2,10,39,43,1,5,43,47,1,5,47,51,2,51,6,55,2,10,55,59,1,59,9,63,2,13,63,67,1,10,67,71,1,71,5,75,1,75,6,79,1,10,79,83,1,5,83,87,1,5,87,91,2,91,6,95,2,6,95,99,2,10,99,103,1,103,5,107,1,2,107,111,1,6,111,0,99,2,14,0,0]
  result = func(seq)
  #print (noun, verb)


print ("***Result***")
print (noun*100 + verb)