from collections import Counter, OrderedDict
from itertools import permutations as perm
from collections import deque
from sys import stdin
from bisect import *
from heapq import *
import math
 
g   = lambda : stdin.readline().strip()
gl  = lambda : g().split()
gil = lambda : [int(var) for var in gl()]
gfl = lambda : [float(var) for var in gl()]
gcl = lambda : list(g())
gbs = lambda : [int(var) for var in g()]
mod = int(1e9)+7
inf = float("inf")
 
n, k = gil()
ans = -inf; m = []
for _ in range(n):
	a, b = gil()
	ans = max(a*b, ans)	
	m.append((b, a))
m.sort()
h = [];cv = 0
for i in reversed(range(n)):
	ans = max(ans, m[i][0]*(cv+m[i][1]))
	heappush(h, m[i][1]); cv += m[i][1]
	if len(h) >= k:
		cv -= heappop(h)
print(ans)

