import sys

n_shops, n_drinks = list(map(int, input().split()))

shop_info = sorted([tuple(map(int, line.split())) for line in sys.stdin.readlines()])

cost = 0

purchased_n_drinks = 0

for _ in range(len(shop_info)):

    info = shop_info.pop(0)

    if (purchased_n_drinks + info[1]) >= n_drinks:

        cost += ( n_drinks - purchased_n_drinks) * info[0]

        break

    purchased_n_drinks += info[1]

    cost += info[0] * info[1]

print(cost)
import sys

readline = sys.stdin.readline



def main():

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

    AB = [list(map(int, readline().rstrip().split())) for _ in range(N)]

    AB.sort()

    pro = 0

    cost = 0

    for a, b in AB:

        if pro + b >= M:

            cost += (M - pro) * a

            break

        pro += b

        cost += a * b

    

    print(cost)





if __name__ == '__main__':

    main()
import sys

n_shops, n_drinks = list(map(int, input().split()))
shop_info = sorted([tuple(map(int, line.split())) for line in sys.stdin.readlines()])
cost = 0
purchased_n_drinks = 0
for _ in range(len(shop_info)):
    info = shop_info.pop(0)
    if (purchased_n_drinks + info[1]) >= n_drinks:
        cost += (n_drinks - purchased_n_drinks) * info[0]
        break
    purchased_n_drinks += info[1]
    cost += info[0] * info[1]
print(cost)

import sys

readline = sys.stdin.readline


def main():
    N, M = list(map(int, readline().rstrip().split()))
    AB = [list(map(int, readline().rstrip().split())) for _ in range(N)]
    AB.sort()
    pro = 0
    cost = 0
    for a, b in AB:
        if pro + b >= M:
            cost += (M - pro) * a
            break
        pro += b
        cost += a * b
    print(cost)


if __name__ == "__main__":
    main()

-n_shops, n_drinks = list(map(int, input().split())) -shop_info = sorted([tuple(map(int, line.split())) for line in sys.stdin.readlines()]) -cost = 0 -purchased_n_drinks = 0 -for _ in range(len(shop_info)): -    info = shop_info.pop(0) -    if (purchased_n_drinks + info[1]) >= n_drinks: -        cost += (n_drinks - purchased_n_drinks) * info[0] -        break -    purchased_n_drinks += info[1] -    cost += info[0] * info[1] -print(cost) +readline = sys.stdin.readline + + +def main(): +    N, M = list(map(int, readline().rstrip().split())) +    AB = [list(map(int, readline().rstrip().split())) for _ in range(N)] +    AB.sort() +    pro = 0 +    cost = 0 +    for a, b in AB: +        if pro + b >= M: +            cost += (M - pro) * a +            break +        pro += b +        cost += a * b +    print(cost) + + +if __name__ == "__main__": +    main()