n = gets.to_i md = 10 ** 9 + 7 sum = 0 n.times do |i| s = gets.split sum = (sum + (s[0].to_f / 2).ceil * s[1].to_i) % md end puts sum