N = int(input()) n = 10**9 + 7 L = [] for i in range(N): c,d = map(int,input().split()) L.append([c,d]) sum = 0 for i in range(N): l0 = L[i][0] * L[i][1] l1 = (L[i][0] + 1) * L[i][1] if L[i][0] % 2 == 0: sum += int(l0/2) else: sum += int(l1/2) sum %= n print(sum)