import heapq
n, k = map(int, input().strip().split())

playlist = []
for i in range(n):
    t, b = map(int, input().strip().split())
    playlist.append((b, t))

playlist.sort(reverse = True)

ans, sumt, d_set = 0, 0, []

for b, t in playlist:
    sumt += t
    heapq.heappush(d_set, t)
    
    if len(d_set) > k:
        sumt -= heapq.heappop(d_set)

    ans = max(ans, sumt * b)

print(ans)