def solve():

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

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

    A.sort()

    ans = 0

    cnt = 0

    for a in A:

        if cnt + a[1] <= M:

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

            cnt += a[1]

        else:

            ans += a[0]*(M-cnt)

            break

    return ans

print((solve()))
from math import ceil

def solve():

    ans = 0

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

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

    A.sort()

    for i in range(N):

        if M<=A[i][1]:

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

            break

        else:

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

            M -= A[i][1]

    return ans

print((solve()))
def solve():
    N, M = list(map(int, input().split()))
    A = [list(map(int, input().split())) for _ in range(N)]
    A.sort()
    ans = 0
    cnt = 0
    for a in A:
        if cnt + a[1] <= M:
            ans += a[1] * a[0]
            cnt += a[1]
        else:
            ans += a[0] * (M - cnt)
            break
    return ans


print((solve()))

from math import ceil


def solve():
    ans = 0
    N, M = list(map(int, input().split()))
    A = [list(map(int, input().split())) for _ in range(N)]
    A.sort()
    for i in range(N):
        if M <= A[i][1]:
            ans += M * A[i][0]
            break
        else:
            ans += A[i][0] * A[i][1]
            M -= A[i][1]
    return ans


print((solve()))

+from math import ceil + + +    ans = 0 -    ans = 0 -    cnt = 0 -    for a in A: -        if cnt + a[1] <= M: -            ans += a[1] * a[0] -            cnt += a[1] +    for i in range(N): +        if M <= A[i][1]: +            ans += M * A[i][0] +            break -            ans += a[0] * (M - cnt) -            break +            ans += A[i][0] * A[i][1] +            M -= A[i][1]