from math import *

from decimal import * 

N = int(eval(input()))

T = []

A = []

for i in range(0, N):

    ti, ai = [Decimal(int(x)) for x in input().split()]

    T.append(ti)

    A.append(ai)



prevT = T[0]

prevA = A[0]

for i in range(1, N):

    nextfacT = int(ceil(prevT / T[i]))

    nextfacA = int(ceil(prevA / A[i]))

    nextfac = max(nextfacT, nextfacA)

    prevT = nextfac * T[i]

    prevA = nextfac * A[i]



print((prevA+prevT))

from math import *

N = int(eval(input()))

T = []

A = []

for i in range(0, N):

    ti, ai = [int(x) for x in input().split()]

    T.append(ti)

    A.append(ai)



prevT = T[0]

prevA = A[0]

for i in range(1, N):

    nextfacT = int(ceil((prevT + T[i] - 1) // T[i]))

    nextfacA = int(ceil((prevA + A[i] - 1) // A[i]))

    nextfac = max(nextfacT, nextfacA)

    prevT = nextfac * T[i]

    prevA = nextfac * A[i]



print((prevA+prevT))

from math import *
from decimal import *

N = int(eval(input()))
T = []
A = []
for i in range(0, N):
    ti, ai = [Decimal(int(x)) for x in input().split()]
    T.append(ti)
    A.append(ai)
prevT = T[0]
prevA = A[0]
for i in range(1, N):
    nextfacT = int(ceil(prevT / T[i]))
    nextfacA = int(ceil(prevA / A[i]))
    nextfac = max(nextfacT, nextfacA)
    prevT = nextfac * T[i]
    prevA = nextfac * A[i]
print((prevA + prevT))

from math import *

N = int(eval(input()))
T = []
A = []
for i in range(0, N):
    ti, ai = [int(x) for x in input().split()]
    T.append(ti)
    A.append(ai)
prevT = T[0]
prevA = A[0]
for i in range(1, N):
    nextfacT = int(ceil((prevT + T[i] - 1) // T[i]))
    nextfacA = int(ceil((prevA + A[i] - 1) // A[i]))
    nextfac = max(nextfacT, nextfacA)
    prevT = nextfac * T[i]
    prevA = nextfac * A[i]
print((prevA + prevT))

-from decimal import * -    ti, ai = [Decimal(int(x)) for x in input().split()] +    ti, ai = [int(x) for x in input().split()] -    nextfacT = int(ceil(prevT / T[i])) -    nextfacA = int(ceil(prevA / A[i])) +    nextfacT = int(ceil((prevT + T[i] - 1) // T[i])) +    nextfacA = int(ceil((prevA + A[i] - 1) // A[i]))