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

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

Drink.sort()



Need = M

Payment = 0

for i in range(N):

    if Need > Drink[i][1]:

        Payment += Drink[i][0] * Drink[i][1]

        Need -= Drink[i][1]

    else:

        Payment += Drink[i][0] * Need

        break

print(Payment)

import sys



def solve():

    input = sys.stdin.readline

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

    drink = [[int(a) for a in input().split()] for _ in range(N)]

    drink.sort()

    price = 0

    for i in range(N):

        a, b = drink[i]

        if b <= M:

            price += a * b

            M -= b

        else:

            price += a * M

            break

    print(price)



    return  0



if __name__ == "__main__":

    solve()
N, M = list(map(int, input().split()))
Drink = [[int(i) for i in input().split()] for _ in range(N)]
Drink.sort()
Need = M
Payment = 0
for i in range(N):
    if Need > Drink[i][1]:
        Payment += Drink[i][0] * Drink[i][1]
        Need -= Drink[i][1]
    else:
        Payment += Drink[i][0] * Need
        break
print(Payment)

import sys


def solve():
    input = sys.stdin.readline
    N, M = list(map(int, input().split()))
    drink = [[int(a) for a in input().split()] for _ in range(N)]
    drink.sort()
    price = 0
    for i in range(N):
        a, b = drink[i]
        if b <= M:
            price += a * b
            M -= b
        else:
            price += a * M
            break
    print(price)
    return 0


if __name__ == "__main__":
    solve()

-N, M = list(map(int, input().split())) -Drink = [[int(i) for i in input().split()] for _ in range(N)] -Drink.sort() -Need = M -Payment = 0 -for i in range(N): -    if Need > Drink[i][1]: -        Payment += Drink[i][0] * Drink[i][1] -        Need -= Drink[i][1] -    else: -        Payment += Drink[i][0] * Need -        break -print(Payment) +import sys + + +def solve(): +    input = sys.stdin.readline +    N, M = list(map(int, input().split())) +    drink = [[int(a) for a in input().split()] for _ in range(N)] +    drink.sort() +    price = 0 +    for i in range(N): +        a, b = drink[i] +        if b <= M: +            price += a * b +            M -= b +        else: +            price += a * M +            break +    print(price) +    return 0 + + +if __name__ == "__main__": +    solve()