class Yukicoder def initialize n = gets.chomp.to_i sum = 0 n.times do c, d = gets.chomp.split(' ').map(&:to_i) sum += (c/2 + c%2) * d sum %= (10 ** 9 + 7) end puts sum end end Yukicoder.new