m = gets.to_i
ds = []
cs = []

m.times{
	d, c = gets.split.map &:to_i
	ds << d
	cs << c
}

sum = 0

remain = []

m.times{ |i|
	mul = ds[i] * cs[i]
	sum += (mul / 10 + cs[i] - 1)
	remain << mul % 10 + mul / 10
}

puts sum + remain.size - 1 + remain.inject(:+) / 10
