program main
  implicit none
  integer(8) :: N,M
  integer(8),allocatable :: A(:),B(:)
  integer(8),allocatable :: A2(:,:)
  integer(8) :: i
  integer(8) :: nout
  integer(8) :: out
  read(*,*) N,M
  allocate(A(N),B(N))
  do i = 1,N
     read(*,*) A(i),B(i)
  end do
  allocate(A2(N,2) )
  A2(:,1) = A(:)
  A2(:,2) = B(:)

  call hsort(N,A2)
  out=0
  nout=0
  do i = 1,N
     nout = nout + A2(i,2)
     out = out +A2(i,1) * A2(i,2)
     if ( nout >= M ) THEn
        out = out - A2(i,1)*(nout-M)
        exit
     end if
  end do
  write(*,'(i0)') out
  stop
contains
  subroutine hsort(n, x)
    implicit none
    integer(8), intent(IN) :: n
    integer(8), intent(INOUT) :: x(n,2)
    ! local
    integer(8) k
    integer(8) :: tmp,tmp2
    ! external subroutine
    !external mkheap

    ! 配列 x 全体をヒープにする。
    do k = n/2, 1, -1
       tmp = x(k,1)
       call mkheap(n, x, k, n, tmp)
    enddo

    ! ヒープの根と右下の葉を交換してソートする。
    do k = n, 2, -1
       tmp = x(k,1)
       x(k,1) = x(1,1)
       tmp2 = x(1,2)
       x(1,2) =x(k,2) 
       x(k,2) = tmp2
       
       call mkheap(n, x, int(1,8), k-1, tmp)
    end do

    return
  end subroutine hsort

  subroutine mkheap(n, x, root, leaf, val)
    implicit none
    integer(8), intent(IN)    :: n, root, leaf
    integer(8), intent(INOUT) :: x(1:n,2)
    integer(8), intent(IN)    :: val
    ! local
    integer(8) :: i, j
    integer(8) :: tmp

    i = root
    j = i * 2

    do
       if (j > leaf) exit

       if (j < leaf) then
          if (x(j,1) < x(j+1,1)) j = j + 1
       end if

       if (x(j,1) > val) then
          x(i,1) = x(j,1)
          tmp = x(j,2)
          x(j,2) = x(i,2)
          x(i,2) = tmp
          i = j
          j = i * 2
       else
          j = leaf + 1
       endif
    end do

    x(i,1) = val

    return
  end subroutine mkheap
  
 end program main
