import heapq

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

a = []
for i in range(n):
    t, b = list(map(int, input().split()))
    a.append([b, t])
a.sort(reverse = True)
p = 0
l = 0
h = []
for b, t in a:
    l += t
    heapq.heappush(h, t)
    if len(h) > k:
        l -= heapq.heappop(h)
    p = max(p, l * b)
print(p)