#Complexity - O(nlogn) - Sorting is involved

import heapq

n, k = map(int, input().split())
inp = []
for i in range(n):
  t, b = map(int, input().split())
  inp.append((b, t))

arr = sorted(inp, reverse=True)
time_heap = []
max_beauty = 0
current_time_sum = 0 

for b, t in arr:
  current_time_sum += t
  heapq.heappush(time_heap, t) 
  if len(time_heap) > k:
    least_time = heapq.heappop(time_heap)
    current_time_sum -= least_time
  
  max_beauty = max(max_beauty, current_time_sum*b)

print(max_beauty)
