N, M=list(map(int, input().split()))  #複数数値入力　「A B」みたいなスペース空いた入力のとき



AB=[[int(i) for i in input().split()] for j in range(N)]  # 二次元配列入力　二次元マップみたいな入力のとき



AB.sort(key=lambda x: x[0])



money = 0

ct = M

for i in AB:

    money += min(ct, i[1]) * i[0]

    ct = ct - min(ct, i[1])

    if ct == 0:

        break

print(money)

N, M = [int(_) for _ in input().split()]

AB = [[int(_) for _ in input().split()] for i in range(N)]



AB.sort(key=lambda x:x[0])



ret = 0

money = 0



for a, b in AB:

    if ret >= M:

        break



    while ret < M and b >= 1:

        b -= 1

        ret += 1

        money += a

        

print(money)
N, M = list(map(int, input().split()))  # 複数数値入力　「A B」みたいなスペース空いた入力のとき
AB = [[int(i) for i in input().split()] for j in range(N)]  # 二次元配列入力　二次元マップみたいな入力のとき
AB.sort(key=lambda x: x[0])
money = 0
ct = M
for i in AB:
    money += min(ct, i[1]) * i[0]
    ct = ct - min(ct, i[1])
    if ct == 0:
        break
print(money)

N, M = [int(_) for _ in input().split()]
AB = [[int(_) for _ in input().split()] for i in range(N)]
AB.sort(key=lambda x: x[0])
ret = 0
money = 0
for a, b in AB:
    if ret >= M:
        break
    while ret < M and b >= 1:
        b -= 1
        ret += 1
        money += a
print(money)

-N, M = list(map(int, input().split()))  # 複数数値入力　「A B」みたいなスペース空いた入力のとき -AB = [[int(i) for i in input().split()] for j in range(N)]  # 二次元配列入力　二次元マップみたいな入力のとき +N, M = [int(_) for _ in input().split()] +AB = [[int(_) for _ in input().split()] for i in range(N)] +ret = 0 -ct = M -for i in AB: -    money += min(ct, i[1]) * i[0] -    ct = ct - min(ct, i[1]) -    if ct == 0: +for a, b in AB: +    if ret >= M: +    while ret < M and b >= 1: +        b -= 1 +        ret += 1 +        money += a