from decimal import Decimal,getcontext

from math import ceil

getcontext().prec = 1000

N = int(eval(input()))



takahashi,aoki = 1,1



for _ in range(N):

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

    c = max(ceil(Decimal(takahashi)/Decimal(a)),ceil(Decimal(aoki)/Decimal(b)))

    takahashi = c*a

    aoki = c*b



print((takahashi+aoki))
from decimal import Decimal,getcontext

from math import ceil



N = int(eval(input()))



takahashi,aoki = 1,1



for _ in range(N):

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

    c = max(ceil(takahashi/Decimal(a)),ceil(aoki/Decimal(b)))

    takahashi = c*a

    aoki = c*b



print((takahashi+aoki))
from decimal import Decimal, getcontext
from math import ceil

getcontext().prec = 1000
N = int(eval(input()))
takahashi, aoki = 1, 1
for _ in range(N):
    a, b = list(map(int, input().split()))
    c = max(ceil(Decimal(takahashi) / Decimal(a)), ceil(Decimal(aoki) / Decimal(b)))
    takahashi = c * a
    aoki = c * b
print((takahashi + aoki))

from decimal import Decimal, getcontext
from math import ceil

N = int(eval(input()))
takahashi, aoki = 1, 1
for _ in range(N):
    a, b = list(map(int, input().split()))
    c = max(ceil(takahashi / Decimal(a)), ceil(aoki / Decimal(b)))
    takahashi = c * a
    aoki = c * b
print((takahashi + aoki))

-getcontext().prec = 1000 -    c = max(ceil(Decimal(takahashi) / Decimal(a)), ceil(Decimal(aoki) / Decimal(b))) +    c = max(ceil(takahashi / Decimal(a)), ceil(aoki / Decimal(b)))