import heapq

n, k = map(int, input().split())
l = []
for _ in range(n):
    t, b = map(int, input().split())
    l.append((b, t))
l = sorted(l, key = lambda x: x[0], reverse = True)
ans = 0
duration = 0
d = []

for b, t in l:
    duration += t
    heapq.heappush(d, t)
    if len(d) > k:
        c = heapq.heappop(d)
        duration -= c
    ans = max(ans, duration*b)
print(ans)
    
