# -*- coding: utf-8 -*-
"""
Spyder Editor

This is a temporary script file.
"""
from heapq import *
n,k=map(int,input().split())
a=[]
for i in range(n):
    y,x=map(int,input().split())
    a.append([x,y])
a.sort(reverse=True)
ans=0
s=0
hp=[]
for i in range(n):
   s+=a[i][1]
   heappush(hp,a[i][1])
   if i>=k :
       s-=heappop(hp)
   ans=max(ans,a[i][0]*s)
print(ans)
       
