import os
from io import BytesIO
input = BytesIO(os.read(0, os.fstat(0).st_size)).readline

from heapq import *

n, k = map(int, input().split())
S = []

for _ in range(n):
    t, b = map(int, input().split())
    S.append((t, b))

S.sort(key=lambda x: (-x[1], -x[0]))

mb, st, cb = 0, 0, 0
pq = []
for t, b in S:
    st += t
    heappush(pq, (t, b))
    if len(pq) > k:
        pt, pb = heappop(pq)
        st -= pt
    mb = max(mb, st*b)

print(mb)