import sys
input=sys.stdin.buffer.readline
from heapq import heappop,heappush,heapify
n,k=map(int,input().split())
he=[]
heapify(he)
a=[]
for i in range(n):
    x,y=map(int,input().split())
    a.append([y,x])
a.sort(reverse=True)
ans=0
count=0
add=1
for i in range(n):
    if add > k and he[0] >=a[i][1]:
        continue
    if add >k:
        count-=he[0]
        heappop(he)
    count += a[i][1]
    heappush(he, a[i][1])
    ans = max(ans, count * a[i][0])
    add+=1
print(ans)