import std.stdio, std.conv, std.math, std.string, std.range, std.array, std.algorithm; enum MOD = 10^^9 + 7; void main(){ immutable N = readln().strip().to!int(); long ans; foreach(immutable i; 0 .. N) { auto buf = readln().strip().split().map!(to!long)().array; ans += ((buf[0] + 1) / 2 % MOD) * (buf[1] % MOD); } writeln(ans); }