import math

from decimal import Decimal





def main():

    N = int(eval(input()))

    t, a = 1, 1

    for _ in range(N):

        _t, _a = list(map(int, input().split()))

        n = Decimal(max(math.ceil(t / _t), math.ceil(a / _a)))

        t, a = _t * n, _a * n



    print((t + a))



if __name__ == '__main__':

    main()

from math import ceil

from fractions import Fraction





def main():

    N = int(eval(input()))

    t, a = 1, 1

    for _ in range(N):

        _t, _a = list(map(int, input().split()))

        n = ceil(max(Fraction(t, _t), Fraction(a, _a)))

        t, a = _t * n, _a * n

    print((t + a))



if __name__ == '__main__':

    main()

import math
from decimal import Decimal


def main():
    N = int(eval(input()))
    t, a = 1, 1
    for _ in range(N):
        _t, _a = list(map(int, input().split()))
        n = Decimal(max(math.ceil(t / _t), math.ceil(a / _a)))
        t, a = _t * n, _a * n
    print((t + a))


if __name__ == "__main__":
    main()

from math import ceil
from fractions import Fraction


def main():
    N = int(eval(input()))
    t, a = 1, 1
    for _ in range(N):
        _t, _a = list(map(int, input().split()))
        n = ceil(max(Fraction(t, _t), Fraction(a, _a)))
        t, a = _t * n, _a * n
    print((t + a))


if __name__ == "__main__":
    main()

-import math -from decimal import Decimal +from math import ceil +from fractions import Fraction -        n = Decimal(max(math.ceil(t / _t), math.ceil(a / _a))) +        n = ceil(max(Fraction(t, _t), Fraction(a, _a)))