n=int(input()) a=0 for i in range(n): c,d=map(int,input().split()) a+=-(-c//2)*d print(a)