program energy_drink_collector
  implicit none
  integer(8) :: n, m, ab(100000,2), i, p
  read(*,*) n, m
  ab = 0_8
  do i = 1, n
    read(*,*) ab(i,:)
  end do
  call merge_sort(n,ab(1:n,:),1_8)
  p = 0
  do i = 1, n
    if (m.le.ab(i,2)) then
      p = p + m*ab(i,1)
      exit
    else
      p = p + ab(i,2)*ab(i,1)
      m = m - ab(i,2)
    end if
  end do
  write(*,'(i0)') p
  stop
contains
  subroutine merge_sort(n,c,idx)
    implicit none
    integer(8), intent(in)    :: n, idx
    integer(8), intent(inout) :: c(n,2)
    integer(8)                :: number, length, i, ubound
    number = n
    length = 1
    do while (number .gt. 1)
      do i = 1, number/2
        ubound = min(2*i*length,n)
        call merge(c(2*(i-1)*length+1:(2*i-1)*length,:),c((2*i-1)*length+1:ubound,:),idx)
      end do
      length = 2*length
      number = (number+1)/2
    end do
    return
  end subroutine merge_sort
  subroutine merge(c1,c2,idx)
    implicit none
    integer(8), intent(inout) :: c1(:,:), c2(:,:)
    integer(8), intent(in)    :: idx
    integer(8)                :: c(size(c1(:,1))+size(c2(:,1)),size(c1(1,:)))
    integer(8)                :: i1, i2, n1, n2
    i1 = 1
    i2 = 1
    n1 = size(c1(:,1))
    n2 = size(c2(:,1))
    do while (i1 .le. n1 .and. i2 .le. n2)
      if (c1(i1,idx) .le. c2(i2,idx)) then
        c(i1+i2-1,:) = c1(i1,:)
        i1 = i1+1
      else
        c(i1+i2-1,:) = c2(i2,:)
        i2 = i2+1
      end if
    end do
    if (i1 .le. n1) then
      c(i1+i2-1:n1+n2,:) = c1(i1:n1,:)
    else if (i2 .le. n2) then
      c(i1+i2-1:n1+n2,:) = c2(i2:n2,:)
    end if
    c1 = c(1:n1,:)
    c2 = c(n1+1:n1+n2,:)
    return
  end subroutine merge
end program energy_drink_collector