@staticmethod
def d():
    (n, *hs) = map(int, sys.stdin.read().split())
    (h, s) = np.array(hs).reshape(n, 2).T
    t = np.arange(n)

    def is_ok(x):
        t_lim = ((x - h) // s)
        t_lim.sort()
        return np.all((t_lim >= t))

    def binary_search():
        (lo, hi) = (0, (10 ** 14))
        while ((lo + 1) < hi):
            x = ((lo + hi) // 2)
            if is_ok(x):
                hi = x
            else:
                lo = x
        return hi
    print(binary_search())
@staticmethod
def d():
    (n, *hs) = map(int, sys.stdin.read().split())
    (h, s) = np.array(hs).reshape(n, 2).T
    t = np.arange(n)

    def is_ok(x):
        t_lim = ((x - h) // s)
        t_lim.sort()
        return np.all((t_lim >= t))

    def binary_search():
        (lo, hi) = (0, (10 ** 14))
        while ((lo + 1) < hi):
            x = ((lo + hi) // 2)
            if is_ok(x):
                hi = x
            else:
                lo = x
        return hi
    print(binary_search())