import heapq

n, k = map(int, input().split())
t = []
b = []
a = []
for i in range(n):
	ti, bi = map(int, input().split())
	
	a.append((ti, bi))

a.sort(key = lambda x: (-x[1]))


mx = -1
lens = 0

c = []

for i in range(n):
	ti, bi = a[i]
	if len(c) < k:
		heapq.heappush(c, ti)
		lens += ti
	else:
		l = heapq.heappushpop(c, ti)
		lens += ti - l
	mx = max(mx, lens * bi)

print(mx)
