# ABC121C - Energy Drink Collector

import sys

input = sys.stdin.readline



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

lst = sorted([list(map(int, input().rstrip().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)
# 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
import sys

input = sys.stdin.readline
n, m = list(map(int, input().rstrip().split()))
lst = sorted([list(map(int, input().rstrip().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)

# 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()

-n, m = list(map(int, input().rstrip().split())) -lst = sorted([list(map(int, input().rstrip().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) + + +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()