from collections import deque
d=deque()
n,k=[int(x) for x in input().split()]
c=[]
lena=0
for i in range(n):
    a,b=[int(x) for x in input().split()]
    c.append((b,a))
c.sort(reverse=True)
answer=[]
summa=0
for item in c:
    if lena>=k:
        a=d.pop()
        summa-=a
        d.append(max(item[1],a))
        summa+=max(item[1],a)   
    else:
        d.append(item[1])
        summa+=item[1]
        lena+=1
    answer.append(summa*item[0])
print(max(answer))
