import sys
import heapq


def input():
    return sys.stdin.readline()


n, k = map(int, input().split())
arr = [(0, 0)] * n
for i in range(n):
    t, b = map(int, input().split())
    arr[i] = (t, b)
arr.sort(key=lambda x: (-x[1], -x[0]))
sum_length = 0
heap_length = []
for i in range(k):
    sum_length += arr[i][0]
    heapq.heappush(heap_length, arr[i][0])
min_beauty = arr[k-1][1]
answer = sum_length * min_beauty
for i in range(k, n):
    min_beauty = arr[i][1]
    min_length = heapq.heappop(heap_length)
    temp = arr[i][0] - min_length
    if (sum_length + temp) * min_beauty > answer:
        sum_length += temp
        heapq.heappush(heap_length, arr[i][0])
        answer = sum_length * min_beauty
    else:
        heapq.heappush(heap_length, min_length)
sum_length = 0
for i in range(k):
    sum_length += arr[i][0]
    min_beauty = arr[i][1]
    answer = max(answer, sum_length * min_beauty)
print(answer)
