import sys,math
from fractions import gcd
import heapq
from collections import defaultdict
from io import BytesIO
sys.stdin = BytesIO(sys.stdin.read())
input = lambda: sys.stdin.readline().rstrip('\r\n')
#t = int(input())
n,k = [int(x) for x in input().split(' ')]
#arr = [int(x) for x in input().split(' ')]
arr = []
for _ in range(n):
    t,b = [int(x) for x in input().split(' ')]
    arr.append([b,t])
arr.sort(reverse = True)

m = 0
cur = []
curl = 0
num = 0
for i in range(n):
    if num < k:
        num += 1
        heapq.heappush(cur,arr[i][1])
        curl += arr[i][1]
        m = max(m,curl*arr[i][0])
    else:
        a = heapq.heappop(cur)
        heapq.heappush(cur,arr[i][1])
        curl -= a
        curl += arr[i][1]
        m = max(m,curl*arr[i][0])

print(m)