import heapq
import sys
input =sys.stdin.buffer.readline
n,k = map(int,input().split())
list1 = []
for i in range(n):
    length,beauty = map(int,input().split())
    list1.append([length,beauty])
list1.sort(key=lambda  x:-x[1])

heap = []
final_ans = 0
curr_length = 0
for i in range(k):
    heapq.heappush(heap,[list1[i][0]])
    curr_length+=list1[i][0]
    final_ans = max(final_ans,curr_length*list1[i][1])
# print(curr_length,heap)
#
# final_ans = max(final_ans,curr_length*heap[0][0])
for i in range(k,n):
    p = heap[0]
    curr_length-=p[0]
    curr_length+=list1[i][0]

    heapq.heapreplace(heap,[list1[i][0]])
    # print(curr_length,heap)
    final_ans= max(final_ans,curr_length*list1[i][1])

print(final_ans)




