import heapq
import io, os

input = io.StringIO(os.read(0, os.fstat(0).st_size).decode()).readline
ii = lambda: int(input())
mi = lambda: map(int, input().split())


n,k = mi()

s = []

for _ in range(n):
    i,j = mi()
    s.append((j,i))

s = sorted(s)[::-1]    

d = []
sm = 0
smm = 0
for i,(s_b, s_len) in enumerate(s):
    if i < k:
        sm += s_len
        heapq.heappush(d,s_len)
    else:
        sm+= s_len - d[0]
        heapq.heappop(d)
        heapq.heappush(d,s_len)

    smm = max(smm,s_b*sm)

print(smm)    
