import sys; input = sys.stdin.readline
from heapq import *
n, k = map(int, input().split())
t, b = [], []
for _ in range(n):
    tt, bb = map(int, input().split())
    t.append(tt); b.append(bb)



songs = sorted(list(zip(b, t)))
mxsum = [songs[-1][1]]
h = []
heappush(h, mxsum[0])
cnt = 1
sm = mxsum[0]

for i in range(n - 2, -1, -1):
    heappush(h, songs[i][1])
    sm += songs[i][1]
    cnt += 1

    if cnt > k:
        sm -= heappop(h)
    mxsum.append(sm)

mxsum = mxsum[::-1]

print(max(s[0]*tt for s, tt in zip(songs, mxsum)))
