N = int(eval(input()))

t = a = 1

for i in range(N):

    T, A = list(map(int, input().split()))

    tb = (t + T - 1) // T

    ab = (a + A - 1) // A

    b = max(tb, ab)

    t = T * b

    a = A * b

print((t+a))
import sys

def main():

    input = sys.stdin.readline

    N = int(eval(input()))



    t, a = 1, 1

    for _ in range(N):

        T, A = list(map(int, input().split()))

        nt = t + (T - (t % T) if t % T else 0)

        na = a + (A - (a % A) if a % A else 0)

        n = na // A if nt // T < na // A else nt // T

        t, a = T * n, A * n

    print((t + a))



if __name__ == '__main__':

    main()
N = int(eval(input()))
t = a = 1
for i in range(N):
    T, A = list(map(int, input().split()))
    tb = (t + T - 1) // T
    ab = (a + A - 1) // A
    b = max(tb, ab)
    t = T * b
    a = A * b
print((t + a))

import sys


def main():
    input = sys.stdin.readline
    N = int(eval(input()))
    t, a = 1, 1
    for _ in range(N):
        T, A = list(map(int, input().split()))
        nt = t + (T - (t % T) if t % T else 0)
        na = a + (A - (a % A) if a % A else 0)
        n = na // A if nt // T < na // A else nt // T
        t, a = T * n, A * n
    print((t + a))


if __name__ == "__main__":
    main()

-N = int(eval(input())) -t = a = 1 -for i in range(N): -    T, A = list(map(int, input().split())) -    tb = (t + T - 1) // T -    ab = (a + A - 1) // A -    b = max(tb, ab) -    t = T * b -    a = A * b -print((t + a)) +import sys + + +def main(): +    input = sys.stdin.readline +    N = int(eval(input())) +    t, a = 1, 1 +    for _ in range(N): +        T, A = list(map(int, input().split())) +        nt = t + (T - (t % T) if t % T else 0) +        na = a + (A - (a % A) if a % A else 0) +        n = na // A if nt // T < na // A else nt // T +        t, a = T * n, A * n +    print((t + a)) + + +if __name__ == "__main__": +    main()