import math

from decimal import *



n = int(eval(input()))

l = [[int(i) for i in input().split()] for j in range(n)]



def newT(t, ratio):

    a = Decimal(t[0]) / Decimal(ratio[0])

    b = Decimal(t[1]) / Decimal(ratio[1])

    if a <= 1 and b <= 1:

        return ratio

    else:

        c = math.ceil(max([a, b]))

        return [i*c for i in ratio]



to = l[0]

for li in l[1:]:

    to = newT(to, li)



print((to[0]+to[1]))

import math

from decimal import *



n = int(eval(input()))

l = [[int(i) for i in input().split()] for j in range(n)]



def newT(t, ratio):

    if t[0] <= ratio[0] and t[1] <= ratio[1]:

        return ratio

    else:

        #切り上げ (x+p-1)//p

        c = max((t[0]+ratio[0]-1)//ratio[0], (t[1]+ratio[1]-1)//ratio[1])

        return [i*c for i in ratio]



to = l[0]

for li in l[1:]:

    to = newT(to, li)



print((to[0]+to[1]))

import math
from decimal import *

n = int(eval(input()))
l = [[int(i) for i in input().split()] for j in range(n)]


def newT(t, ratio):
    a = Decimal(t[0]) / Decimal(ratio[0])
    b = Decimal(t[1]) / Decimal(ratio[1])
    if a <= 1 and b <= 1:
        return ratio
    else:
        c = math.ceil(max([a, b]))
        return [i * c for i in ratio]


to = l[0]
for li in l[1:]:
    to = newT(to, li)
print((to[0] + to[1]))

import math
from decimal import *

n = int(eval(input()))
l = [[int(i) for i in input().split()] for j in range(n)]


def newT(t, ratio):
    if t[0] <= ratio[0] and t[1] <= ratio[1]:
        return ratio
    else:
        # 切り上げ (x+p-1)//p
        c = max((t[0] + ratio[0] - 1) // ratio[0], (t[1] + ratio[1] - 1) // ratio[1])
        return [i * c for i in ratio]


to = l[0]
for li in l[1:]:
    to = newT(to, li)
print((to[0] + to[1]))

-    a = Decimal(t[0]) / Decimal(ratio[0]) -    b = Decimal(t[1]) / Decimal(ratio[1]) -    if a <= 1 and b <= 1: +    if t[0] <= ratio[0] and t[1] <= ratio[1]: -        c = math.ceil(max([a, b])) +        # 切り上げ (x+p-1)//p +        c = max((t[0] + ratio[0] - 1) // ratio[0], (t[1] + ratio[1] - 1) // ratio[1])