import heapq
R = lambda: map(int, input().split())
n,k = R()
L = []
for i in range(n):
    L.append(list(R()))
L = sorted(L, key = lambda x:x[1])
A = []
res,p = 0,0
for i in reversed(range(n)):
    p += L[i][0]
    heapq.heappush(A,L[i][0])
    if len(A) > k:
        p -= (heapq.heappop(A))
    res = max(res,L[i][1]*p)
print(res)