# 初期入力
import sys
input = sys.stdin.readline
N,M = (int(i) for i in input().split())
A=[0]*N
B=[0]*N
for i in range(N):
    a,b = (int(i) for i in input().split())
    A[i] =(a,b)

#　1本が安い順にソート、安店から順番に買う
A.sort()
num_sum =0
price_sum =0
for i in range(N):
    price,num =A[i]
    if num_sum < M -num:
        num_sum  +=num
        price_sum += price *num
    elif num_sum == M -num:
        price_sum +=price *num
        break
    else:
        price_sum +=price*(M -num_sum)
        break
print(price_sum) import sys sys input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline int(i) for i in input().split() for i in input().split() i input().split() ().split () input split for i in input().split() int(i) int i N,M = (int(i) for i in input().split()) N (int(i) for i in input().split()) M A=[0]*N A [0]*N [0] 0 N B=[0]*N B [0]*N [0] 0 N for i in range(N):
    a,b = (int(i) for i in input().split())
    A[i] =(a,b)

#　1本が安い順にソート、安店から順番に買う i range(N) range N int(i) for i in input().split() for i in input().split() i input().split() ().split () input split for i in input().split() int(i) int i a,b = (int(i) for i in input().split()) a (int(i) for i in input().split()) b A[i] =(a,b) A[i] A i (a,b) a b A.sort() A.sort A sort num_sum =0 num_sum 0 price_sum =0 price_sum 0 for i in range(N):
    price,num =A[i]
    if num_sum < M -num:
        num_sum  +=num
        price_sum += price *num
    elif num_sum == M -num:
        price_sum +=price *num
        break
    else:
        price_sum +=price*(M -num_sum)
        break i range(N) range N price,num =A[i] price A[i] A i num if num_sum < M -num:
        num_sum  +=num
        price_sum += price *num
    elif num_sum == M -num:
        price_sum +=price *num
        break
    else:
        price_sum +=price*(M -num_sum)
        break num_sum < M -num num_sum M -num M num num_sum  +=num num_sum num price_sum += price *num price_sum price *num price num elif num_sum == M -num:
        price_sum +=price *num
        break
     num_sum == M -num num_sum M -num M num price_sum +=price *num price_sum price *num price num break price_sum +=price*(M -num_sum) price_sum price*(M -num_sum) price M -num_sum M num_sum break print(price_sum) print price_sum M = (int(i) for i in input().split()) (int(i) for i in input().split()) M price,num =A[i] A[i] price A=[0]*N [0]*N A a,b = (int(i) for i in input().split()) (int(i) for i in input().split()) a num_sum =0 0 num_sum B=[0]*N [0]*N B b = (int(i) for i in input().split()) (int(i) for i in input().split()) b price_sum +=price *num price *num price_sum price_sum += price *num price *num price_sum price_sum =0 0 price_sum N,M = (int(i) for i in input().split()) (int(i) for i in input().split()) N num =A[i] A[i] num num_sum  +=num num num_sum input = sys.stdin.readline sys.stdin.readline input price_sum +=price*(M -num_sum) price*(M -num_sum) price_sum
# 初期入力
import sys
input = sys.stdin.readline
N,M = (int(i) for i in input().split())
A=[0]*N
B=[0]*N
for i in range(N):
    a,b = (int(i) for i in input().split())
    A[i] =(a,b)

#　1本が安い順にソート、安店から順番に買う
A.sort()
num_sum =0
price_sum =0
for i in range(N):
    price,num =A[i]
    if num_sum < M -num:
        num_sum  +=num
        price_sum += price *num
    elif num_sum == M -num:
        price_sum +=price *num
        break
    else:
        price_sum +=price*(M -num_sum)
        break
print(price_sum)