import heapq
n, k = map(int, input().split())
songs = sorted([tuple(map(int, input().split())) for _ in range(n)], key=lambda x: -x[1])

ans = -float("inf")
S = []
tmpS = 0
for t, v in songs:
    if len(S) < k:
        heapq.heappush(S, t)
        tmpS += t
        minB = v
    else:
        tmp = heapq.heappop(S)
        if tmp < t:
            tmpS = tmpS - tmp + t
            heapq.heappush(S, t)
            minB = v
        else:
            heapq.heappush(S, tmp)
            minB = v

    ans = max(ans, minB*tmpS)
print(ans)
