N=int(input()) ANS=0 for i in range(N): a,b=map(int,input().split()) ANS+=(a+1)//2*b print(ANS)