import math, sequtils, strutils, sugar const m = 10 ^ 9 + 7 let n = parseInt readLine stdin xs = newSeq.collect: for _ in 0 ..< n: let cd = stdin.readLine.split.map parseInt c = cd[0].succ div 2 mod m d = cd[1] mod m c * d mod m echo (sum xs) mod m