import math def main(): n = int(input()) ans = 0 for _ in range(n): c, d = map(int, input().split()) ans += math.ceil(c / 2) * d print(ans % (10 ** 9 + 7)) if __name__ == '__main__': main()