import heapq

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

a=[]
for i in range(n):
    a.append(tuple(map(int,input().split())))

a.sort(key=lambda x:x[1])
b=[]
i=n-1
summ=0
val=0
while k>0:
    summ+=a[i][0]
    val=max(val,summ*a[i][1])
    heapq.heappush(b,a[i][0])
    i-=1
    k-=1
while i>=0:
    t=heapq.heappop(b)
    heapq.heappush(b,a[i][0])
    summ-=t
    summ+=a[i][0]
    val=max(val,summ*a[i][1])
    i-=1
print(val)