from heapq import heappush, heappop
h = []
n,k = map(int, input().strip().split())
l = []
for i in range(n):
    t,b = map(int, input().strip().split())
    l.append([b,t])
l.sort()
ans = 0
sm = 0
for i in range(n-1,-1,-1):
    heappush(h,l[i][1])
    sm += l[i][1]
    if len(h) > k:
        sm -= heappop(h)
    ans = max(ans,l[i][0]*sm)
print(ans)