import heapq

n, lim = map(int, input().split())
songs = sorted([tuple(map(int, input().split())) for _ in range(n)], key=lambda x: x[1], reverse=True)

h = []
ret = 0
s = 0
for t, b in songs:
    s += t
    heapq.heappush(h, t)
    if len(h) > lim:
        s -= heapq.heappop(h)
    ret = max(ret, s * b)
print(ret)
