N = int(input()) cnt = 0 for i in range(N): C, D = map(lambda x : int(x) % (10E9 + 7), input().split(' ')) cnt += (C + 1) // 2 * D print(int(cnt))