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

AB = []

for i in range(N):

    AB.append(list(map(int, input().split())))

    

AB.sort(key=lambda x:x[0])



kane = 0

hon = 0

for i in range(N):

    if hon + AB[i][1] < M:

        hon += AB[i][1]

        kane += AB[i][0] * AB[i][1]

        continue

    elif hon + AB[i][1] == M:

        hon += AB[i][1]

        kane += AB[i][0] * AB[i][1]

        print(kane)

        break

    else:

        kane += (M - hon) * AB[i][0]

        print(kane)

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

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

AB = sorted(AB, key=lambda x:x[0])

ans = 0

for a, b in AB:

    if b <= M:

       ans += a * b

       M -= b

    else:

        ans += a * M

        break

    if M == 0:

        break

print(ans)
N, M = list(map(int, input().split()))
AB = []
for i in range(N):
    AB.append(list(map(int, input().split())))
AB.sort(key=lambda x: x[0])
kane = 0
hon = 0
for i in range(N):
    if hon + AB[i][1] < M:
        hon += AB[i][1]
        kane += AB[i][0] * AB[i][1]
        continue
    elif hon + AB[i][1] == M:
        hon += AB[i][1]
        kane += AB[i][0] * AB[i][1]
        print(kane)
        break
    else:
        kane += (M - hon) * AB[i][0]
        print(kane)
        break

N, M = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(N)]
AB = sorted(AB, key=lambda x: x[0])
ans = 0
for a, b in AB:
    if b <= M:
        ans += a * b
        M -= b
    else:
        ans += a * M
        break
    if M == 0:
        break
print(ans)

-AB = [] -for i in range(N): -    AB.append(list(map(int, input().split()))) -AB.sort(key=lambda x: x[0]) -kane = 0 -hon = 0 -for i in range(N): -    if hon + AB[i][1] < M: -        hon += AB[i][1] -        kane += AB[i][0] * AB[i][1] -        continue -    elif hon + AB[i][1] == M: -        hon += AB[i][1] -        kane += AB[i][0] * AB[i][1] -        print(kane) +AB = [list(map(int, input().split())) for _ in range(N)] +AB = sorted(AB, key=lambda x: x[0]) +ans = 0 +for a, b in AB: +    if b <= M: +        ans += a * b +        M -= b +    else: +        ans += a * M -    else: -        kane += (M - hon) * AB[i][0] -        print(kane) +    if M == 0: +print(ans)