import heapq
arr = input()

N,K = [int(x) for x in arr.split(' ')]

data = [[0]*2 for _ in range(N)]

for i in range(N):
    arr = input()
    L,B = [int(x) for x in arr.split(' ')]
    
    data[i][0] = B
    data[i][1] = L
    
data.sort(reverse=True)
#print(data)

h = []

s = 0
res = 0
for i in range(N):
    if i<K:
        s += data[i][1]
        heapq.heappush(h, data[i][1])
    else:
        s += data[i][1]
        heapq.heappush(h, data[i][1])
        p = heapq.heappop(h)
        s -= p
    
    if s*data[i][0]>res:
        res = s*data[i][0]

print(res)