from sys import stdin
import heapq as hp
n,k=map(int,stdin.readline().strip().split())
s=[]
for i in range(n):
    a,b=map(int,stdin.readline().strip().split())
    s.append((b,a))
s.sort(reverse=True)
s1=[]
sm=0
ans=0
for i in range(k):
    sm+=s[i][1]
    hp.heappush(s1,s[i][1])
    ans=max(sm*s[i][0],ans)
for i in range(k,n):
    x=hp.heappop(s1)
    if s[i][1]>x:
        sm-=x
        sm+=s[i][1]
        hp.heappush(s1,s[i][1])
    else:
        hp.heappush(s1,x)
    ans=max(ans,sm*s[i][0])
print(ans)
        
        
