n, k = map(int, input().split())

songs = []
for i in range(n):
	t, b = map(int, input().split())
	songs.append((b, t))
	
ss = sorted(songs)

klist = []

for i in range(k+1):
	klist.append([0, 0])
	
startk = 2
klist[1] = [ss[-1][0]*ss[-1][1], ss[-1][0]]
maxn = klist[1][0]

for i in range(n - 2, -1, -1):
	b = ss[i][0]
	t = ss[i][1]
	j = startk
	if j == 1:
		nsumt = t*b
	else:
		sumt = klist[j-1][0]
		oldb = klist[j-1][1]
		nsumt = int(((sumt/oldb) + t) * b)

	if nsumt > klist[j][0]:
		maxn = max(maxn, nsumt)
		klist[j][0] = nsumt
		klist[j][1] = b
		
	if startk < k:
		startk += 1

print(maxn)