using System; using System.Linq; class No146 { static void Main() { var count = Int64.Parse(Console.ReadLine()); var mod = 1000000007; long ans = 0; for (long i = 0; i < count; ++i) { var chair = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray(); var p = ((chair[0]+1)/ 2)%mod; ans += p * chair[1]; ans %= mod; } Console.WriteLine(ans); } }