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

A = [0]*N

for i in range(N):

  A[i] = [0,0]

  A[i][0],A[i][1] = list(map(int, input().split()))

A.sort()

sum = 0

for a in A:

  if a[1]<M:

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

    M -= a[1]

  else:

    sum += a[0]*M

    print(sum)

    exit()



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()))
N, M = list(map(int, input().split()))
A = [0] * N
for i in range(N):
    A[i] = [0, 0]
    A[i][0], A[i][1] = list(map(int, input().split()))
A.sort()
sum = 0
for a in A:
    if a[1] < M:
        sum += a[0] * a[1]
        M -= a[1]
    else:
        sum += a[0] * M
        print(sum)
        exit()

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()))

-N, M = list(map(int, input().split())) -A = [0] * N -for i in range(N): -    A[i] = [0, 0] -    A[i][0], A[i][1] = list(map(int, input().split())) -A.sort() -sum = 0 -for a in A: -    if a[1] < M: -        sum += a[0] * a[1] -        M -= a[1] -    else: -        sum += a[0] * M -        print(sum) -        exit() +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()))