import io, os
input = io.StringIO(os.read(0, os.fstat(0).st_size).decode()).readline

ii = lambda: int(input())
mi = lambda: map(int, input().split())
li = lambda: list(mi())

from heapq import heappush, heappop

n, k = mi()
a = [li() for i in range(n)]
a = sorted((b, t) for t, b in a)
h = []
ans = sm = 0
for b, t in a[::-1]:
    sm += t
    heappush(h, t)
    if len(h) > k:
        sm -= heappop(h)
    ans = max(ans, sm * b)
print(ans)