from heapq import *
kk=lambda:map(int,input().split())
k2=lambda:map(lambda x:int(x)-1, input().split())
ll=lambda:list(kk())
n,k=kk()
ls = [None]*n
for i in range(n):
	ls[i] = tuple(kk())
ls.sort(key=lambda x: x[1])
q,totall,m = [],0,0
heapify(q)
for s in reversed(ls):

	if len(q) < k:
		heappush(q, s)
		totall+= s[0]
	else:
		m = max(m, s[1]*(totall-q[0][0]+s[0]))
		if s[0] > q[0][0]:
			totall -= heappushpop(q, s)[0]
			totall+= s[0]
	m = max(m, totall*s[1])
print(m)