import sys
sys.setrecursionlimit(10000000)
mod = 10 ** 9 + 7
digl=['0','1','2','3','4','5','6','7','8','9']
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
ls = lambda : list(input())
import heapq
n,k=f()
l=[]
for _ in range(n):
    i,j=f()
    l.append([i,j])
ans=0
tl=0
songs=[]
l.sort(key=lambda x: x[1], reverse=True)
for x, y in l:
    heapq.heappush(songs, x)
    tl+=x
    if len(songs)>k:
        p=heapq.heappop(songs)
        tl -= p
    ans=max(ans,tl*y)
print(ans)

