from heapq import *
n,k = map(int,input().split())
a = []
for i in range(n):
    a.append(list(map(int,input().split()))[::-1])
a.sort(reverse = True)
ans = s = 0
t = []
for i,j in a:
    s += j
    heappush(t,j)
    if len(t) > k:
        s -= heappop(t)
    ans = max(ans,s*i)
print(ans)
