
import sys
from collections import defaultdict
import heapq 
strInp = lambda : input().strip().split()
intInp = lambda : list(map(int,strInp()))

n , k = intInp()
arr = [] 
li = []
for i in range(n):
    l , b = intInp() 
    arr.append([l,b])
    


arr.sort(key = lambda x: x[1],reverse=True) 
heapq.heapify(li)
ans = 0
s = 0
index = 1
for i in range(n):
    if index < k :
        heapq.heappush(li,arr[i][0])
        s += arr[i][0]
        ans = max(ans,arr[i][0]*arr[i][1],s*arr[i][1])
    else:
        heapq.heappush(li,arr[i][0])
        s += arr[i][0]
        ans = max(s*arr[i][1],ans)
        mi = heapq.heappop(li)
        s -= mi 
    index += 1

print(ans)


    
            

    
