
import heapq

"""
n,k=4, 3
A=[[4, 7],
[15, 1],
[3, 6],
[6, 8]]
"""
n,k=map(int, raw_input().split())

H=[]
for i in range(n):
    a,b=map(int, raw_input().split())
    #a,b=A[i]
    H.append((b,a))


H.sort(reverse=True)

Q=[]
vt=0
s=0
for i in range(n):
    x,y=H[i]
    if i<k:
        heapq.heappush(Q,y)
        s+=x
    else:
        t=Q[0]
        if t<y:
            s=s-t+y
            heapq.heappop(Q)
            heapq.heappush(Q,y)
    vt=max(vt,x*s)

print vt





