

def resolve():

    N = int(eval(input()))



    S = 0

    D = 0

    for i in range(N):

        d, c = list(map(int, input().split()))

        S += d*c

        D += c



    print(((D-1) + (S-1)//9))



if __name__ == "__main__":

    resolve()


import sys

sys.setrecursionlimit(10 ** 7)

read = sys.stdin.buffer.read 

inp = sys.stdin.buffer.readline



def resolve():

    N = int(inp())



    S = 0

    D = 0

    for i in range(N):

        d, c = list(map(int, inp().split()))

        S += d*c

        D += c



    print(((D-1) + (S-1)//9))



if __name__ == "__main__":

    resolve()
def resolve():
    N = int(eval(input()))
    S = 0
    D = 0
    for i in range(N):
        d, c = list(map(int, input().split()))
        S += d * c
        D += c
    print(((D - 1) + (S - 1) // 9))


if __name__ == "__main__":
    resolve()

import sys

sys.setrecursionlimit(10**7)
read = sys.stdin.buffer.read
inp = sys.stdin.buffer.readline


def resolve():
    N = int(inp())
    S = 0
    D = 0
    for i in range(N):
        d, c = list(map(int, inp().split()))
        S += d * c
        D += c
    print(((D - 1) + (S - 1) // 9))


if __name__ == "__main__":
    resolve()

+import sys + +sys.setrecursionlimit(10**7) +read = sys.stdin.buffer.read +inp = sys.stdin.buffer.readline + + -    N = int(eval(input())) +    N = int(inp()) -        d, c = list(map(int, input().split())) +        d, c = list(map(int, inp().split()))