# ABC121C - Energy Drink Collector

import sys

input = sys.stdin.readline



def main():

    n, m = list(map(int, input().rstrip().split()))

    lst = sorted(list(map(int, input().split())) for _ in range(n))

    ans = 0

    for i in lst:

        while i[1] > 0 and m > 0:

            ans += i[0]

            i[1] -= 1

            m -= 1

    print(ans)





if __name__ == "__main__":

    main()
# ABC121C - Energy Drink Collector

def main():

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

    AB = list(zip(*[iter(AB)] * 2))

    AB.sort()

    ans = 0

    for a, b in AB:

        while b > 0 and M > 0:

            ans += a

            b -= 1

            M -= 1

    print(ans)





if __name__ == "__main__":

    main()

# ABC121C - Energy Drink Collector
import sys

input = sys.stdin.readline


def main():
    n, m = list(map(int, input().rstrip().split()))
    lst = sorted(list(map(int, input().split())) for _ in range(n))
    ans = 0
    for i in lst:
        while i[1] > 0 and m > 0:
            ans += i[0]
            i[1] -= 1
            m -= 1
    print(ans)


if __name__ == "__main__":
    main()

# ABC121C - Energy Drink Collector
def main():
    N, M, *AB = list(map(int, open(0).read().split()))
    AB = list(zip(*[iter(AB)] * 2))
    AB.sort()
    ans = 0
    for a, b in AB:
        while b > 0 and M > 0:
            ans += a
            b -= 1
            M -= 1
    print(ans)


if __name__ == "__main__":
    main()

-import sys - -input = sys.stdin.readline - - -    n, m = list(map(int, input().rstrip().split())) -    lst = sorted(list(map(int, input().split())) for _ in range(n)) +    N, M, *AB = list(map(int, open(0).read().split())) +    AB = list(zip(*[iter(AB)] * 2)) +    AB.sort() -    for i in lst: -        while i[1] > 0 and m > 0: -            ans += i[0] -            i[1] -= 1 -            m -= 1 +    for a, b in AB: +        while b > 0 and M > 0: +            ans += a +            b -= 1 +            M -= 1