'''input
3 2
1 100
5 5
100000 1
'''
from sys import stdin, stdout
import math
import heapq

# main starts
n, k = list(map(int, stdin.readline().split()))
playlist = []
for _ in range(n):
	playlist.append(list(map(int, stdin.readline().split())))

playlist = sorted(playlist, key = lambda x: x[1], reverse = True)
#print(playlist)
myheap = []
heapq.heapify(myheap)
cur_sum  = 0
mx_beauty = -float('inf')
for i in playlist:
	if len(myheap) < k:
		cur_sum += i[0]
		heapq.heappush(myheap, i)
		mx_beauty =  max(mx_beauty, cur_sum * i[1])
	else:
		first, second = heapq.heappop(myheap)
		if first < i[0]:
			cur_sum -= first
			cur_sum += i[0]
			heapq.heappush(myheap, i)
			mx_beauty =  max(mx_beauty, cur_sum * i[1])
		else:
			heapq.heappush(myheap, [first, second])
			continue
print(mx_beauty)
	

