import heapq
N, K = map(int, input().split())
songs = []
for n in range(N):
    t, b = map(int, input().split())
    songs.append((b, t))
songs.sort(reverse=True)
ans = 0
tlen = 0
theap = []
for b, t in songs:
    tlen += t
    heapq.heappush(theap, t)
    while len(theap) > K:
        x = heapq.heappop(theap)
        tlen -= x
    ans = max(ans, tlen*b)
print(ans)
