from heapq import *
n,k=list(map(int,input().split()))
a=[]
for i in range(0,n):
	b,p=list(map(int,input().split()))
	a.append([p,b])
a.sort(reverse=True)
r=0
s=0
h=[]
for p,b in a:
	s+=b
	heappush(h,b)
	if len(h)>k:
		s-=heappop(h)
	r=max(r,s*p)
print(r)

