from sys import stdin
import heapq
input=stdin.readline
def f(a,k):
	h=[]
	ans=-222222222
	a=sorted(a,key=lambda s:s[1],reverse=True)
	s=0
	for ad,p in a:
		heapq.heappush(h,ad)
		s+=ad
		if len(h)>k:
			s-=heapq.heappop(h)
		ans=max(ans,s*p)
	return ans
n,m=map(int,input().strip().split())
blanck=[]
for i in range(n):
	x,y=map(int,input().strip().split())
	blanck.append((x,y))

print(f(blanck,m))