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] mod m d = cd[1] mod m c.succ div 2 * d mod m echo (sum xs) mod m