read N M
ANS=0

sort -nk1,1 | while read A B; do
    if [ $B -le $M ]; then
        ANS=$(($ANS+$A*$B))
        M=$(($M-$B))
    else
        ANS=$(($ANS+$M*$A))
        M=0
    fi
    
    if [ $M -eq 0 ]; then
        echo $ANS
        exit
    fi
done