import bisect
import heapq
n,k=map(int,input().split())
li=[]
for i in range(n):
    li.append(tuple(map(int,input().split())))
li.sort(key=lambda tup:-tup[1])
c=0
l=[]
ln=0
for a,b in li:
    heapq.heappush(l,a)
    ln+=a
    if len(l)>k:
        p=heapq.heappop(l)
        ln-=p
    if c<ln*b:
        c=ln*b
print(c)