N, K = map(int, input().split())
songs = []
for i in range(N):
    songs.append(tuple(map(int, input().split())))

songs = sorted(songs, key=lambda x:-x[1])

ans = -1
mul = -1
acc = []
for i in range(K):
    song = songs[i]
    if i == 0:
        mul = song[1]
        ans = song[0] * mul
        acc.append(song[0])
    else:
        mul = min(mul, song[1])
        tmp = (acc[-1] + song[0]) * mul
        if tmp < ans:
            print(ans)
            exit()
        else:
            ans = tmp
            acc.append(acc[-1] + song[0])

songs = sorted(songs, key=lambda x:-x[0])

ans2 = -1
mul = -1
acc = []
for i in range(K):
    song = songs[i]
    if i == 0:
        mul = song[1]
        ans2 = song[0] * mul
        acc.append(song[0])
    else:
        mul = min(mul, song[1])
        tmp = (acc[-1] + song[0]) * mul
        if tmp < ans2:
            print(ans2)
            exit()
        else:
            ans2 = tmp
            acc.append(acc[-1] + song[0])

print(max(ans, ans2))

