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