n = gets.chomp.to_i max = 1_000_000_000 + 7 population = 0 n.times { c, d = gets.chomp.split.map(&:to_i) population += ((c.to_f / 2).ceil * d) % max } puts(population % max)