from heapq import *

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)

ans = 0
l = 0
h = []
for b, t in a:
    l += t
    heappush(h, t)
    if len(h) > k: 
        l -= heappop(h)
    ans = max(ans, l * b)

print(ans)


