from sys import stdin
from heapq import heappush
from heapq import heappop
n, k = map(int, stdin.readline().split())
a = [(0, 0)] * n
for i in xrange(n):
    t, b = map(int, stdin.readline().split())
    a[i] = (b, t)
a.sort()
h = []
d = [0] * n
c = 0
i = n - 1
while i >= 0:
    c += a[i][1]
    heappush(h, a[i][1])
    if len(h) > k:
        x = heappop(h)
        c -= x
    d[i] = c
    i -= 1
m = 0
for i in xrange(n):
    m = max(m, a[i][0] * d[i])
print m