from sys import stdin,stdout
n,k=map(int,stdin.readline().split())
l=[]
def fun(itm):
         return (itm[1]+1)*10000000+itm[0]
for i in range(n):
         l.append(list(map(int,stdin.readline().split())))
l.sort(key=fun,reverse=True)
ans=0
s=0
c=0
for i in range(n):
         s+=l[i][0]
         if(i>=k):
                  s-=l[i-k][0]
         c=s*l[i][1]
         ans=max(ans,c)
stdout.write(str(ans))
         