import heapq as hp
import math
import bisect
import itertools
import sys
I=lambda : sys.stdin.readline()
n,k=map(int,input().split())
a=[]
for i in range(n):
    x,y=map(int,I().split())
    a.append([y,x])
a.sort(reverse=True)    
ma=-1
c=0
s=0
h=[]
for i in a:
    c+=1
    x,y=i[1],i[0]
    if c<=k:
        s+=x
        ma=max(s*y,ma)
        hp.heappush(h,x)
    else:
        if x>h[0]:
            s+=x
            s-=hp.heappop(h)
            hp.heappush(h,x)
        ma=max(s*y,ma)
    #print(ma,s)    
print(ma)    
            

