n, k = map(int, input().split())
songs = []
for i in range(n):
    a, b = list(map(int, input().split()))

    songs.append([b, a])
songs.sort(reverse = True)

def update(k, x):
    k += N0-1
    data[k] = x
    while k >= 0:
        k = (k - 1) // 2
        data[k] = min(data[2*k+1], data[2*k+2])

def query(l, r):
    L = l + N0; R = r + N0
    s = INF
    while L < R:
        if R & 1:
            R -= 1
            s = min(s, data[R-1])

        if L & 1:
            s = min(s, data[L-1])
            L += 1
        L >>= 1; R >>= 1
    return s

N0 = 2**(n-1).bit_length()
INF = 2**31-1
data = [INF]*(2*N0+1)


goodsongs = []
goodsongcount = 1
timesum = 0
ans = 0
minsong = 10000000
for i in range(n):
    if i+1 <= k:
        update(goodsongcount, songs[i][1])
        timesum += songs[i][1]
        ans = max(ans, timesum*songs[i][0])
    else:
        if minsong >= songs[i][1]:
            continue
        else:
            timesum += songs[i][1] - minsong
            minsong = query(0, n+1)
            ans = max(ans, timesum*songs[i][0])
print(ans)
