import heapq
from sys import stdin
input = stdin.readline
n, k = map(int,input().split())
b_t = []
for _ in range(n):
    t,b = tuple(map(int,input().split()))
    b_t.append( (b,t) )
b_t.sort( reverse=True )

ans = 0
time = 0
l = []
for b,t in b_t: #sorted by beauty
    time += t
    heapq.heappush( l, t )
    if len(l) > k:  #taking largest k time (b will be always greater)
        c = heapq.heappop(l)
        time -= c #subtract time
    ans = max( ans, time*b )
print(ans)