program main
implicit none
integer :: n, m, i, j, s, amx, amn
integer , allocatable :: a( : ) , b( : )

read(*,*) n, m
allocate( a(n) )
allocate( b(n) )
do i = 1, n
   read(*,*) a(i) , b(i)
end do

amx = maxval( a )
amn = minval( a )
s = 0
do i = 1, n
   do j = 1, m
      if( a(j) == minval( a ) ) then
         if( m - b(j) < 0 ) then
            s = s + a(j)*m
            write(*,'(i0)') s
            stop
         end if
         s = s + a(j)*b(j)
         a(j) = amx+1
         m = m - b(j)
      end if
   end do
end do
         



end program main
