# coding: utf-8

import sys



sr = lambda: sys.stdin.readline().rstrip()

ir = lambda: int(sr())

lr = lambda: list(map(int, sr().split()))



N, M = lr()

AB = [lr() for _ in range(N)]

AB.sort()

drink = 0

answer = 0

for i in range(N):

    cost = AB[i][0]

    limit = AB[i][1]

    if drink + limit < M:

        answer += cost * limit

        drink += limit

    else:

        x = M - drink

        answer += cost * x

        break



print(answer)

# coding: utf-8

import sys



sr = lambda: sys.stdin.readline().rstrip()

ir = lambda: int(sr())

lr = lambda: list(map(int, sr().split()))



N, M = lr()

AB = [lr() for _ in range(N)]

AB.sort()

answer = 0

for cost, num in AB:

    if M - num > 0:

        answer += cost * num

        M -= num

    else:

        answer += cost * M

        break



print(answer)

# coding: utf-8
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N, M = lr()
AB = [lr() for _ in range(N)]
AB.sort()
drink = 0
answer = 0
for i in range(N):
    cost = AB[i][0]
    limit = AB[i][1]
    if drink + limit < M:
        answer += cost * limit
        drink += limit
    else:
        x = M - drink
        answer += cost * x
        break
print(answer)

# coding: utf-8
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N, M = lr()
AB = [lr() for _ in range(N)]
AB.sort()
answer = 0
for cost, num in AB:
    if M - num > 0:
        answer += cost * num
        M -= num
    else:
        answer += cost * M
        break
print(answer)

-drink = 0 -for i in range(N): -    cost = AB[i][0] -    limit = AB[i][1] -    if drink + limit < M: -        answer += cost * limit -        drink += limit +for cost, num in AB: +    if M - num > 0: +        answer += cost * num +        M -= num -        x = M - drink -        answer += cost * x +        answer += cost * M