
from heapq import *
n,k=map(int,input().split())
arr1=[]
for i in range(n):
    arr1.append(list(map(int,input().split()))[::-1])
arr1.sort(reverse=True)    
ans=s=0
t=[]
for i,j in arr1:
    s+=j
    heappush(t,j)
    if len(t)>k:
        s-=heappop(t)
    ans=max(ans,s*i)
print(ans)

