n=int(input()) l=[list(map(int,input().split())) for i in range(n)] ans=0 for i in range(n): ans+=((l[i][0]+1)//2)*l[i][1] print(ans)