using System; using System.Linq; namespace _146 { class Program { static void Main(string[] args) { int n = int.Parse(Console.ReadLine()); long ret = 0; int mod = (int)Math.Pow(10,9) + 7; for (int i = 0; i < n; i++) { long[] x = Console.ReadLine().Split().Select(long.Parse).ToArray(); x[0] = (x[0] + 1) / 2; long a = x[0]; a %= mod; a *= x[1]; a %= mod; ret += a; ret %= mod; } Console.WriteLine(ret); } } }