# Problem C - Energy Drink Collector



# input

N, M = list(map(int, input().split()))

ab_list = []

for i in range(N):

    a, b = list(map(int, input().split()))

    ab_list.append([a, b])



# initialization

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

min_cost = 0



# count

i = 0

nokori = M

while nokori>0:

    a, b = ab_list[i]



    if nokori-b<0:

        b = nokori

        nokori = 0

    else:

        nokori -= b



    min_cost += a * b

    i += 1



# output

print(min_cost)

# Problem C - Energy Drink Collector

# input

N, M = list(map(int, input().split()))

ab_list = []

for i in range(N):

    a, b = list(map(int, input().split()))

    ab_list.append([a, b])



# initialization

nokori = M

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

ans = 0



# count

i = 0

while nokori>0:

    ab = ab_list[i]

    a = ab[0]

    b = ab[1]

    if b<=nokori:

        ans += a * b

        nokori -= b

    else:

        ans += a * nokori

        break

    i += 1



# output

print(ans)

# Problem C - Energy Drink Collector
# input
N, M = list(map(int, input().split()))
ab_list = []
for i in range(N):
    a, b = list(map(int, input().split()))
    ab_list.append([a, b])
# initialization
ab_list = sorted(ab_list, key=lambda x: x[0])
min_cost = 0
# count
i = 0
nokori = M
while nokori > 0:
    a, b = ab_list[i]
    if nokori - b < 0:
        b = nokori
        nokori = 0
    else:
        nokori -= b
    min_cost += a * b
    i += 1
# output
print(min_cost)

# Problem C - Energy Drink Collector
# input
N, M = list(map(int, input().split()))
ab_list = []
for i in range(N):
    a, b = list(map(int, input().split()))
    ab_list.append([a, b])
# initialization
nokori = M
ab_list = sorted(ab_list, key=lambda x: x[0])
ans = 0
# count
i = 0
while nokori > 0:
    ab = ab_list[i]
    a = ab[0]
    b = ab[1]
    if b <= nokori:
        ans += a * b
        nokori -= b
    else:
        ans += a * nokori
        break
    i += 1
# output
print(ans)

+nokori = M -min_cost = 0 +ans = 0 -nokori = M -    a, b = ab_list[i] -    if nokori - b < 0: -        b = nokori -        nokori = 0 +    ab = ab_list[i] +    a = ab[0] +    b = ab[1] +    if b <= nokori: +        ans += a * b +        nokori -= b -        nokori -= b -    min_cost += a * b +        ans += a * nokori +        break -print(min_cost) +print(ans)