from sys import stdin
from heapq import heappush as push, heappop as pop

n, k = map(int, raw_input().strip().split())
songs = []
inp = stdin.readlines()
for line in inp:
    t, b = map(int, line.strip().split())
    songs.append([b, t])

songs.sort()

runsum = ans = 0
h = []
m = float('inf')
for i in xrange(n - 1, n - k - 1, -1):
    push(h, songs[i][1])
    runsum += songs[i][1]
    m = min(m, songs[i][0])
    cur = runsum * m
    ans = max(ans, cur)

for i in xrange(n - k - 1, -1, -1):
    topush = songs[i][1]
    top = pop(h)
    if topush <= top:
        push(h, top)
        continue
    else:
        push(h, topush)
        runsum -= top
        runsum += topush
        m = min(m, songs[i][0])
        cur = runsum * m
        ans = max(ans, cur)

print ans