N = int(input()) S = 0 for i in range(N): C, D = map(int, input().split()) S += ((C+1)//2)*D print(S)