from heapq import heapify, heappop, heappush
n, k = list(map(int, input().split()))
data = [ list(map(int, input().split())) for i in range(n)]
data.sort(key= lambda x : -x[1])

ans = 0
heap = []
total_len = 0

for i, j in data:
	ans = max(ans,(total_len + i)*j)
	total_len += i
	heappush(heap, i)
	if len(heap) == k:
                total_len -= heap[0]
                heappop(heap)
print(ans)

