output_description: Print the minimum possible total number of votes obtained by Takahashi and
  Aoki when AtCoDeer checked the report for the N-th time.
  
  * * *
input_description: The input is given from Standard Input in the following format:
  
      
      
      N
      T_1 A_1
      T_2 A_2
      :
      T_N A_N
attempt: import math
  from decimal import Decimal
  
  N = int(input())
  T, A = [int(x) for x in input().split()]
  
  for i in range(1,N):
          T2, A2 = [int(x) for x in input().split()]
          n = max(math.ceil(Decimal(T)/Decimal(T2)),math.ceil(Decimal(A)/Decimal(A2))
          T = T2*n
          A = A2*n
  
  print(T + A)
problem_description: Statement
  
  AtCoDeer the deer is seeing a quick report of election results on TV. Two
  candidates are standing for the election: Takahashi and Aoki. The report shows
  the ratio of the current numbers of votes the two candidates have obtained,
  but not the actual numbers of votes. AtCoDeer has checked the report N times,
  and when he checked it for the i-th (1≦i≦N) time, the ratio was T_i:A_i. It is
  known that each candidate had at least one vote when he checked the report for
  the first time.
  
  Find the minimum possible total number of votes obtained by the two candidates
  when he checked the report for the N-th time. It can be assumed that the
  number of votes obtained by each candidate never decreases.
samples: [{"input": "3\n    2 3\n    1 1\n    3 2", "output": "10\n    \n\nWhen the numbers of votes obtained by the two candidates change as 2,3 \u2192 3,3 \u2192\n6,4, the total number of votes at the end is 10, which is the minimum possible\nnumber.\n\n* * *"}, {"input": "4\n    1 1\n    1 1\n    1 5\n    1 100", "output": "101\n    \n\nIt is possible that neither candidate obtained a vote between the moment when\nhe checked the report, and the moment when he checked it for the next time.\n\n* * *"}, {"input": "5\n    3 10\n    48 17\n    31 199\n    231 23\n    3 2", "output": "6930"}]