List = []

N, M = (int(x) for x in input().split())

for i in range(N):

    a, b = (int(x) for x in input().split())

    List.append([a, b])



num_of_drink, total_fee = 0, 0

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



temp_M = M

list_of_num = []

for i in range(N):

    if temp_M <= List[i][1]:

        list_of_num.append(temp_M)

        break

    else:

        list_of_num.append(List[i][1])

        temp_M += -List[i][1]

index = 0

for x in list_of_num:

    total_fee += List[index][0] * x

    index += 1

print(total_fee)
import sys

input = sys.stdin.readline

List = []

N, M = (int(x) for x in input().split())

for i in range(N):

    a, b = (int(x) for x in input().split())

    List.append([a, b])



num_of_drink, total_fee = 0, 0

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



temp_M = M

list_of_num = []

for i in range(N):

    if temp_M <= List[i][1]:

        list_of_num.append(temp_M)

        break

    else:

        list_of_num.append(List[i][1])

        temp_M += -List[i][1]

index = 0

for x in list_of_num:

    total_fee += List[index][0] * x

    index += 1

print(total_fee)
List = []
N, M = (int(x) for x in input().split())
for i in range(N):
    a, b = (int(x) for x in input().split())
    List.append([a, b])
num_of_drink, total_fee = 0, 0
List = sorted(List, key=lambda x: x[0])
temp_M = M
list_of_num = []
for i in range(N):
    if temp_M <= List[i][1]:
        list_of_num.append(temp_M)
        break
    else:
        list_of_num.append(List[i][1])
        temp_M += -List[i][1]
index = 0
for x in list_of_num:
    total_fee += List[index][0] * x
    index += 1
print(total_fee)

import sys

input = sys.stdin.readline
List = []
N, M = (int(x) for x in input().split())
for i in range(N):
    a, b = (int(x) for x in input().split())
    List.append([a, b])
num_of_drink, total_fee = 0, 0
List = sorted(List, key=lambda x: x[0])
temp_M = M
list_of_num = []
for i in range(N):
    if temp_M <= List[i][1]:
        list_of_num.append(temp_M)
        break
    else:
        list_of_num.append(List[i][1])
        temp_M += -List[i][1]
index = 0
for x in list_of_num:
    total_fee += List[index][0] * x
    index += 1
print(total_fee)

+import sys + +input = sys.stdin.readline