def c_AtCoDeer_and_ElectionReport(N, R):

    from math import ceil

    from decimal import Decimal

    t = 1  # 高橋の票数

    a = 1  # 青木の票数

    for x, y in R:

        n = Decimal(max(ceil(t / x), ceil(a / y)))

        t = n * x

        a = n * y

    return t + a



N = int(eval(input()))

R = [[int(i) for i in input().split()] for j in range(N)]

print((c_AtCoDeer_and_ElectionReport(N, R)))
def c_atcodeer_and_election_report(N, R):

    t, a = 1, 1  # 高橋, 青木の票数

    for x, y in R:

        # t<=nx ∧ a<=ny を満たす最小のnを求める

        n = max(t // x, a // y)

        if t > n * x or a > n * y:

            n += 1

        t = n * x

        a = n * y

    return t + a



N = int(eval(input()))

R = [[int(i) for i in input().split()] for j in range(N)]

print((c_atcodeer_and_election_report(N, R)))
def c_AtCoDeer_and_ElectionReport(N, R):
    from math import ceil
    from decimal import Decimal

    t = 1  # 高橋の票数
    a = 1  # 青木の票数
    for x, y in R:
        n = Decimal(max(ceil(t / x), ceil(a / y)))
        t = n * x
        a = n * y
    return t + a


N = int(eval(input()))
R = [[int(i) for i in input().split()] for j in range(N)]
print((c_AtCoDeer_and_ElectionReport(N, R)))

def c_atcodeer_and_election_report(N, R):
    t, a = 1, 1  # 高橋, 青木の票数
    for x, y in R:
        # t<=nx ∧ a<=ny を満たす最小のnを求める
        n = max(t // x, a // y)
        if t > n * x or a > n * y:
            n += 1
        t = n * x
        a = n * y
    return t + a


N = int(eval(input()))
R = [[int(i) for i in input().split()] for j in range(N)]
print((c_atcodeer_and_election_report(N, R)))

-def c_AtCoDeer_and_ElectionReport(N, R): -    from math import ceil -    from decimal import Decimal - -    t = 1  # 高橋の票数 -    a = 1  # 青木の票数 +def c_atcodeer_and_election_report(N, R): +    t, a = 1, 1  # 高橋, 青木の票数 -        n = Decimal(max(ceil(t / x), ceil(a / y))) +        # t<=nx ∧ a<=ny を満たす最小のnを求める +        n = max(t // x, a // y) +        if t > n * x or a > n * y: +            n += 1 -print((c_AtCoDeer_and_ElectionReport(N, R))) +print((c_atcodeer_and_election_report(N, R)))