from operator import itemgetter
from heapq import heappush, heappushpop
import sys
N, K = map(int, input().split())
TB = [tuple(map(int, sys.stdin.readline().split())) for _ in range(N)]
TB.sort(key = itemgetter(1), reverse = True)
Q = []
sumi = 0
ans = 0
for t, b in TB[:K]:
    sumi += t
    heappush(Q, t)
    ans = max(ans, sumi*b)
for t, b in TB[K:]:
    sumi += t - heappushpop(Q, t)
    ans = max(ans, sumi*b)
print(ans)