#KS wont work using heaps
import heapq as h
plist=[]
h.heapify(plist)
n,k=map(int,input().split())
q=[]
for _ in range(n):
	t,d=map(int,input().split())
	q.append([d,t])
q.sort(reverse=True)
sm=0
ans=0

for i in range(n):
	h.heappush(plist,q[i][1])
	sm+=q[i][1]
	if(i>=k):
		y=h.heappop(plist)
		sm-=y
	ans=max(ans,sm*q[i][0])

print(ans)