ans = 0 gets.to_i.times{ c,d = gets.chomp.split(" ").map(&:to_i) ans += ((c + 1) / 2) * d } print ans % 1000000007