# stdin=open('input.txt')

# def input():
# 	return stdin.readline()[:-1]

# a, b = map(int, input().split())

# l = list(map(int, input().split()))


# CODE BEGINS HERE.................

from heapq import heappush,heappop

n, k = map(int, input().split())

a = []

for i in range(n):
	x, y = map(int, input().split())
	a.append([y, x])

a.sort(reverse = True)

heap = []
sumOfCurrPlaylist = 0
best = 0
for beauty, length in a:
	sumOfCurrPlaylist += length
	heappush(heap, length)

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

	best = max(best, sumOfCurrPlaylist*beauty)


print(best)

#CODE ENDS HERE....................



