program DISCO2020yD
integer::M
integer(16)::d,c
integer(16)::bonus
integer(16)::ans
read*,M
ans=0
bonus=0
do i=1,M
  read*,d,c
  bonus=bonus+d*c
  ans=ans+c
end do
print"(i0)",ans+(bonus-1_16)/10_16 -1_16
end
