N, M, *A = list(map(int, open(0).read().split()))

*A, = list(zip(*[iter(A)]*2))

A.sort()



ans = 0

for a, b in A:

    ans += a*min(b, M)

    M -= min(b, M)



    if M == 0:

        break

print(ans)
N, M, *A = list(map(int, open(0).read().split()))

*A, = list(zip(*[iter(A)]*2))

A.sort()



sun = 0

cost = 0

for a, b in A:

    if sun + b <= M:

        sun += b

        cost += a*b

        if sun == M:

            print(cost)

            break

    else:

        cost += (M-sun)*a

        print(cost)

        break

    
N, M, *A = list(map(int, open(0).read().split()))
(*A,) = list(zip(*[iter(A)] * 2))
A.sort()
ans = 0
for a, b in A:
    ans += a * min(b, M)
    M -= min(b, M)
    if M == 0:
        break
print(ans)

N, M, *A = list(map(int, open(0).read().split()))
(*A,) = list(zip(*[iter(A)] * 2))
A.sort()
sun = 0
cost = 0
for a, b in A:
    if sun + b <= M:
        sun += b
        cost += a * b
        if sun == M:
            print(cost)
            break
    else:
        cost += (M - sun) * a
        print(cost)
        break

-ans = 0 +sun = 0 +cost = 0 -    ans += a * min(b, M) -    M -= min(b, M) -    if M == 0: +    if sun + b <= M: +        sun += b +        cost += a * b +        if sun == M: +            print(cost) +            break +    else: +        cost += (M - sun) * a +        print(cost) -print(ans)