# ARC062C - AtCoDeerくんと選挙速報 / AtCoDeer and Election Report (ABC046C)

def main():

    n = int(eval(input()))

    arr = tuple(tuple(map(int, input().rstrip().split())) for _ in range(n))

    t, a = 1, 1

    for i, j in arr:

        r = max((t - 1) // i + 1, (a - 1) // j + 1)

        t, a = i * r, j * r

    print((t + a))





if __name__ == "__main__":

    main()
# ARC062C - AtCoDeerくんと選挙速報 / AtCoDeer and Election Report

def main():

    N, *TA = list(map(int, open(0).read().split()))

    t, a = TA[:2]

    for i, j in zip(*[iter(TA[2:])] * 2):

        x = max((t + i - 1) // i, (a + j - 1) // j)

        t, a = i * x, j * x

    print((t + a))





if __name__ == "__main__":

    main()
# ARC062C - AtCoDeerくんと選挙速報 / AtCoDeer and Election Report (ABC046C)
def main():
    n = int(eval(input()))
    arr = tuple(tuple(map(int, input().rstrip().split())) for _ in range(n))
    t, a = 1, 1
    for i, j in arr:
        r = max((t - 1) // i + 1, (a - 1) // j + 1)
        t, a = i * r, j * r
    print((t + a))


if __name__ == "__main__":
    main()

# ARC062C - AtCoDeerくんと選挙速報 / AtCoDeer and Election Report
def main():
    N, *TA = list(map(int, open(0).read().split()))
    t, a = TA[:2]
    for i, j in zip(*[iter(TA[2:])] * 2):
        x = max((t + i - 1) // i, (a + j - 1) // j)
        t, a = i * x, j * x
    print((t + a))


if __name__ == "__main__":
    main()

-# ARC062C - AtCoDeerくんと選挙速報 / AtCoDeer and Election Report (ABC046C) +# ARC062C - AtCoDeerくんと選挙速報 / AtCoDeer and Election Report -    n = int(eval(input())) -    arr = tuple(tuple(map(int, input().rstrip().split())) for _ in range(n)) -    t, a = 1, 1 -    for i, j in arr: -        r = max((t - 1) // i + 1, (a - 1) // j + 1) -        t, a = i * r, j * r +    N, *TA = list(map(int, open(0).read().split())) +    t, a = TA[:2] +    for i, j in zip(*[iter(TA[2:])] * 2): +        x = max((t + i - 1) // i, (a + j - 1) // j) +        t, a = i * x, j * x