import heapq

n,k = map(int, input().split())
bt = []
for i in range(n):
    t,b = map(int, input().split())
    bt.append((b,t))
bt.sort(reverse=True)
h = []
heapq.heappush(h, bt[0][1])
leng = bt[0][1]
minb = bt[0][0]
ans = leng*minb
for i in range(1,n):
    if len(h) < k:
        heapq.heappush(h, bt[i][1])
        leng += bt[i][1]
    else:
        popd = heapq.heappushpop(h, bt[i][1])
        leng = leng + bt[i][1] - popd
    minb = bt[i][0]
    if leng*minb > ans:
        ans = leng*minb
print(ans)
