from sys import stdin
import heapq
input=stdin.readline
n,k=map(int,input().split())
tb=[list(map(int,input().split())) for i in range(n)]
tb.sort(key=lambda x:x[1])
hq=[]
s=0
ans=0
for i in range(k):
  heapq.heappush(hq,tb[n-1-i][0])
  s+=tb[n-1-i][0]
  ans=max(ans,s*tb[n-1-i][1])
for i in range(n-k)[::-1]:
  val=heapq.heappop(hq)
  y=max(tb[i][0],val)
  s+=y-val
  heapq.heappush(hq,y)
  ans=max(ans,s*tb[i][1])
print(ans)