



from heapq import *



n,k = map(int,input().split())

l = []
la = []
for i in range(n):

    a,b = map(int,input().split())

    l.append([b,a])

l.sort()
l.reverse()

maxi = 0

h = []

s = 0
for i in range(n):
    a,b = l[i][1],l[i][0]
    s+=a
    heappush(h,a)
    if len(h)>k:
       d = heappop(h)
       s-=d

    maxi = max(maxi,(b*s))

print(maxi)









