import heapq
n,k=map(int,input().split())
a=[]
for j in range(n):
    u,v=map(int,input().split())
    a.append([v,u])
a.sort(reverse=True)
s=0
h=[]
p=0
for v,u in a:
    s=s+u
    heapq.heappush(h,u)
    if len(h)>k:
        s=s-heapq.heappop(h)
    p=max(p,s*v)
print(p)
    
    