import heapq 
n, k = input().split()
n = int(n); k = int(k);
v = []
aux = []
ans = 0
soma = 0
for i in range(0, n):
	t, b = input().split()
	t = int(t); b = int(b)
	v.append((b, t))

v.sort()
	
for i in range(n - 1, -1, -1):
	soma += v[i][1]
	heapq.heappush(aux, v[i][1])
	while(len(aux) > k):
		soma -= heapq.heappop(aux)
	ans = max(ans, soma * v[i][0])

print(ans)