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