from heapq import heappush, heappop
import sys

n, k = map(int, input().split())
songs = sorted((map(lambda x: (int(x[1]), int(x[0])), map(str.split, sys.stdin))), reverse=True)

ans = 0
total_current_duration = 0
heap = []

for beauty, duration in songs:
	total_current_duration += duration
	heappush(heap, duration)

	if len(heap) > k:
		total_current_duration -= heappop(heap)

	ans = max(ans, total_current_duration * beauty)

print(ans)