import heapq
n,k=map(int,input().split())
tb=[]
for i in range(n):
	u,v=map(int,input().split())
	tb.append([u,v])
tb.sort(key=lambda x:x[1])
t=[i[0] for i in tb]
b=[i[1] for i in tb]
su=0
m=0
i=n-1
while i>=n-k:
	su+=t[i]
	m=max(m,su*b[i])
	i-=1
d=t[n-k:]
heapq.heapify(d)
while i>-1:
	heapq.heappush(d,t[i])
	su=su+t[i]-heapq.heappop(d)
	m=max(m,su*b[i])
	i-=1
print(m)