思路:
while (t:=int(input())) != 0:
timel=0
a=[]
for i in range(t):
n,m=list(map(int,input().split()))
a.append([n,m,n*m])
a.sort(key=lambda x:x[2])
for i in a:
timel=timel+i[0]+i[1]*timel
print(timel)
思路:
while (t:=int(input())) != 0:
timel=0
a=[]
for i in range(t):
n,m=list(map(int,input().split()))
a.append([n,m,n*m])
a.sort(key=lambda x:x[2])
for i in a:
timel=timel+i[0]+i[1]*timel
print(timel)