import sys

import math



N = int(sys.stdin.readline().strip())



ratios = []

for _ in range(N):

    t, a = list(map(int, sys.stdin.readline().strip().split()))

    ratios.append((t, a))



ans = 0

for i in range(N-1):

    t1, a1 = ratios[i]

    t2, a2 = ratios[i+1]



    # math.ceilが直球だが、精度が悪い？

    # rate = max(math.ceil(t1 / t2), math.ceil(a1 / a2))

    rate = max((t1 - 1) // t2, (a1 - 1) // a2) + 1

    ratios[i+1] = (t2 * rate, a2 * rate)



print((sum(ratios[N-1])))
import sys



input = sys.stdin.readline

N = int(eval(input()))



rates = []

for _ in range(N):

    t, a = list(map(int, input().split()))

    rates.append((t, a))



ans = 0

for i in range(N-1):

    t1, a1 = rates[i]

    t2, a2 = rates[i+1]



    rate = max((t1 - 1) // t2, (a1 - 1) // a2) + 1

    rates[i+1] = (t2 * rate, a2 * rate)



print((sum(rates[N-1])))
import sys
import math

N = int(sys.stdin.readline().strip())
ratios = []
for _ in range(N):
    t, a = list(map(int, sys.stdin.readline().strip().split()))
    ratios.append((t, a))
ans = 0
for i in range(N - 1):
    t1, a1 = ratios[i]
    t2, a2 = ratios[i + 1]
    # math.ceilが直球だが、精度が悪い？
    # rate = max(math.ceil(t1 / t2), math.ceil(a1 / a2))
    rate = max((t1 - 1) // t2, (a1 - 1) // a2) + 1
    ratios[i + 1] = (t2 * rate, a2 * rate)
print((sum(ratios[N - 1])))

import sys

input = sys.stdin.readline
N = int(eval(input()))
rates = []
for _ in range(N):
    t, a = list(map(int, input().split()))
    rates.append((t, a))
ans = 0
for i in range(N - 1):
    t1, a1 = rates[i]
    t2, a2 = rates[i + 1]
    rate = max((t1 - 1) // t2, (a1 - 1) // a2) + 1
    rates[i + 1] = (t2 * rate, a2 * rate)
print((sum(rates[N - 1])))

-import math -N = int(sys.stdin.readline().strip()) -ratios = [] +input = sys.stdin.readline +N = int(eval(input())) +rates = [] -    t, a = list(map(int, sys.stdin.readline().strip().split())) -    ratios.append((t, a)) +    t, a = list(map(int, input().split())) +    rates.append((t, a)) -    t1, a1 = ratios[i] -    t2, a2 = ratios[i + 1] -    # math.ceilが直球だが、精度が悪い？ -    # rate = max(math.ceil(t1 / t2), math.ceil(a1 / a2)) +    t1, a1 = rates[i] +    t2, a2 = rates[i + 1] -    ratios[i + 1] = (t2 * rate, a2 * rate) -print((sum(ratios[N - 1]))) +    rates[i + 1] = (t2 * rate, a2 * rate) +print((sum(rates[N - 1])))