import sys
import io, os
input = sys.stdin.buffer.readline
#input = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline

n,k = map(int, input().split())
BT = []
for i in range(n):
    t, b = map(int, input().split())
    BT.append((b, t))
BT.sort(reverse=True)
A = []
ans = -10**18
s = 0
for i in range(k):
    b, t = BT[i]
    A.append(t)
    s += t
    ans = max(ans, s*b)
import heapq
heapq.heapify(A)
for i in range(k, n):
    b, t = BT[i]
    s -= A[0]
    s += t
    heapq.heappop(A)
    heapq.heappush(A, t)
    ans = max(ans, s*b)
print(ans)
