import heapq
n,k=list(map(int,input().split()))
tb=[]
for i in range(n):
    tb.append(list(map(int,input().split())))
tb.sort(key=lambda x: x[1])
tb=tb[::-1]
l=[]
s=0
m=0
for i in range(n):
    m=max(m,tb[i][0]*tb[i][1])
for i in range(n):
    heapq.heappush(l,tb[i][0])
    s=s+tb[i][0]
    if len(l)>k:
        
        s=s-heapq.heappop(l)
    m=max(m,tb[i][1]*s)
print(m)