import sequtils,strutils var N = stdin.readline.parseInt d,c,ans : int64 m : int64 = 1_000_000_007 for n in 1..N: (c, d) = stdin.readline.split.map(parseBiggestInt) ans = (ans + (d mod m) * (((c + 1) div 2) mod m)) mod m echo ans