from math import ceil import sys def main(): input = sys.stdin.readline MOD = 10**9 + 7 N = int(input()) t = 0 for _ in range(N): c,d = [int(i) for i in input().split()] t = (t + ceil(c/2) * d)%MOD print(t%MOD) if __name__ == "__main__": main()