# Your code here!

m = gets.to_i
cnt = 0
digit = 0
m.times{
    line = gets.split(' ')
    d = line[0]
    c = line[1]
    d = d.to_i
  	c = c.to_i
    cnt += c*d
    digit += c
}

cnt /= 10
puts(digit - 1+ cnt)