#!/usr/bin/python
import heapq


def cmp_songs(x,y):
	if (x[1] == y[1]):
		if (x[0] > y[0]):
			return 1
		elif (x[0] < y[0]):
			return -1
		else:
			return 0
	if (x[1] > y[1]):
		return 1
	if (x[1] < y[1]):
		return -1

n,k = raw_input().split()
k=int(k)
n=int(n)
playList = []

for i in range(n):
	t,b = raw_input().split()
	playList.append((int(b),int(t)))
playList.sort(reverse=True)
#print(playList)
#print("SORTED")

bestPlayList=[]
lens=[]
heapq.heapify(lens)
max_pleasure=0
pleasure=0
tmp=0
lens_sum=0
for song in playList:
	lens_len = len(lens)
	if lens_len < k:
		heapq.heappush(lens,song[1])
		lens_sum=lens_sum+song[1]
	else:
		if tmp >= song[1]:
			continue
		tmp = heapq.heappushpop(lens,song[1])
		lens_sum=lens_sum-tmp+song[1]
	
	lower_beuty=song[0]

		
	pleasure = lens_sum*lower_beuty
#	pleasure = sum(heapq.nlargest(lens_len, lens))*lower_beuty
	if max_pleasure < pleasure:
		max_pleasure = pleasure

print(max_pleasure)
	
