import sys

input = sys.stdin.buffer.readline

from collections import deque



def main():

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



    AB = [0] * N

    for i in range(N):

        AB[i] = list(map(int, input().split()))



    AB = sorted(AB)



    have = 0

    price = 0

    for x, y in AB:

        if M - have < y:

            price += x * (M - have)

            break



        else:

            price += x * y

            have += y





    print(price)



main()
import sys

read = sys.stdin.buffer.read

readline = sys.stdin.buffer.readline

readlines = sys.stdin.buffer.readlines







def main():

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

    d = list(map(int, read().split()))

    AB = list(zip(d, d))

    AB = sorted(AB)



    have = 0

    price = 0

    for x, y in AB:

        if M - have < y:

            price += x * (M - have)

            break



        else:

            price += x * y

            have += y





    print(price)



main()
import sys

input = sys.stdin.buffer.readline
from collections import deque


def main():
    N, M = list(map(int, input().split()))
    AB = [0] * N
    for i in range(N):
        AB[i] = list(map(int, input().split()))
    AB = sorted(AB)
    have = 0
    price = 0
    for x, y in AB:
        if M - have < y:
            price += x * (M - have)
            break
        else:
            price += x * y
            have += y
    print(price)


main()

import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


def main():
    N, M = list(map(int, readline().split()))
    d = list(map(int, read().split()))
    AB = list(zip(d, d))
    AB = sorted(AB)
    have = 0
    price = 0
    for x, y in AB:
        if M - have < y:
            price += x * (M - have)
            break
        else:
            price += x * y
            have += y
    print(price)


main()

-input = sys.stdin.buffer.readline -from collections import deque +read = sys.stdin.buffer.read +readline = sys.stdin.buffer.readline +readlines = sys.stdin.buffer.readlines -    N, M = list(map(int, input().split())) -    AB = [0] * N -    for i in range(N): -        AB[i] = list(map(int, input().split())) +    N, M = list(map(int, readline().split())) +    d = list(map(int, read().split())) +    AB = list(zip(d, d))