def main(): N = int(input()) total_count = 0 for i in range(N): C, D = map(int, input().split()) total_count += ((C + 1) // 2) * D print(total_count % (10 ** 9 + 7)) if __name__ == '__main__': main()