t = int(input()) total = 0 for i in range(t): p, n = map(int,input().split()) if p % 2 == 0: c = p//2 else: c = p//2 + 1 total += c*n print(total)