intin=lambda:map(int,input().split())
Ain=lambda:list(map(int,input().split()))
from _heapq import heappush, heappop

n,k=intin()
a=[];sm=0

for I in range(n):
    x,y=intin()
    a.append([y,x])

a.sort(reverse = True)
h=[]
ans=0
for i in range(n):
    heappush(h, a[i][1])
    sm+=a[i][1]
    tmp=0
    if len(h)>k:
        tmp=heappop(h)
    sm-=tmp
    ans=max(ans,sm*a[i][0])
    #print('x ',sm,a[i][0],sm*a[i][0])
print(ans)

    










