program main
	implicit none
    integer :: n, m
    integer(8), allocatable :: a(:), b(:)
    integer :: i, j
    integer(8) :: tenpo, kosu, amari
	integer(8) :: kakaku
	read(*, *) n, m
    allocate(a(n)); allocate(b(n))
    do i = 1, n
    	read(*, *) a(i), b(i)
    enddo
	call heapsort2(n, a, b)
    amari = m
    tenpo = 0
    do while (amari.gt.0)
    	tenpo = tenpo + 1
		amari = amari - b(tenpo)
    enddo
    kakaku = 0
    do i = 1, tenpo-1
    	kakaku = kakaku + a(i)*b(i)
    enddo
    kakaku = kakaku + a(tenpo)*(b(tenpo)+amari)
    write(*, *) kakaku
stop
end program main

subroutine heapsort2(n,a,b)
  implicit none
  integer,intent(in) :: n
  integer(8),intent(inout) :: a(n), b(n)
  integer :: i, j, k, l
  integer(8) :: tmp1, tmp2
  l = n/2 + 1
  k = n
  do while (k.ne.1)
     if (l.gt.1) then
        l = l - 1
        tmp1 = a(l)
        tmp2 = b(l)
     else
        tmp1 = a(k)
        tmp2 = b(k)
        a(k) = a(1)
        b(k) = b(1)
        k = k - 1
        if (k.eq.1) then
           a(1) = tmp1
           b(1) = tmp2
           exit
        endif
     endif
     i = l
     j = l + l
     do while (j.le.k)
        if (j.lt.k) then
           if (a(j).lt.a(j+1)) j=j+1
        endif
        if (tmp1.lt.a(j)) then
           a(i) = a(j)
           b(i) = b(j)
           i = j
           j = j + j
        else
           j = k + 1
        endif
     enddo
     a(i) = tmp1
     b(i) = tmp2
  enddo
  return
end subroutine heapsort2