n, k = map(int,input().split())
a = []
t, b = [], []
for i in range(n):
	x, y = map(int,input().split())
	a.append([y, x])
	t.append(x)
	b.append(y)
a.sort()
s = 0
for i in range(n-1, n-1-k, -1):
	s += a[i][1]
ans = 0
for i in range(n-k):
	minn = a[i][0]
	ans = max(ans, (s+a[i][1])*a[i][0])
print (ans)

