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

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

AB.sort()

ans = 0

while M > 0:

    ab = AB[0]

    if ab[1] <= M:

        M-= ab[1]

        ans += ab[0] * ab[1]

        AB.pop(0)

    else:

        ans += ab[0] * M

        M -= M

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

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

AB.sort()

i = 0

ans = 0

while M > 0:

    if M >= AB[i][1]:

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

        M -= AB[i][1]

        i += 1

    else:

        ans += AB[i][0]*M

        break

print(ans)
N, M = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(N)]
AB.sort()
ans = 0
while M > 0:
    ab = AB[0]
    if ab[1] <= M:
        M -= ab[1]
        ans += ab[0] * ab[1]
        AB.pop(0)
    else:
        ans += ab[0] * M
        M -= M
print(ans)

N, M = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(N)]
AB.sort()
i = 0
ans = 0
while M > 0:
    if M >= AB[i][1]:
        ans += AB[i][0] * AB[i][1]
        M -= AB[i][1]
        i += 1
    else:
        ans += AB[i][0] * M
        break
print(ans)

+i = 0 -    ab = AB[0] -    if ab[1] <= M: -        M -= ab[1] -        ans += ab[0] * ab[1] -        AB.pop(0) +    if M >= AB[i][1]: +        ans += AB[i][0] * AB[i][1] +        M -= AB[i][1] +        i += 1 -        ans += ab[0] * M -        M -= M +        ans += AB[i][0] * M +        break