import heapq
n,k=map(int,input().split())
ar=[]
for i in range(n):
    ar.append(list(map(int,input().split())))
ar.sort(key=lambda x:x[1])
tem=[]
su=0
ans=0
for i in range(min(k,n)):
    su+=ar[-(i+1)][0]
    tem.append(ar[-(i+1)][0])
    ans=max(ans,ar[-(i+1)][1]*su)
heapq.heapify(tem)
for i in range(k,n):
    yy=ar[-(i+1)][0]
    xx=heapq.heappushpop(tem,yy)
    su+=(yy-xx)
    ans=max(ans,ar[-(i+1)][1]*su)
print(ans)