program balanced_piles
  implicit none
  integer(8), parameter :: md = 1000000007_8
  integer :: n, h, d, i
  integer(8) :: dp(1000000) = 0_8, f = 1_8, k = 0_8, s = 0_8
  read(*,*) n, h, d
  do i = 1, n
    f = mod(int(i,8)*f,md)
    k = mod(k+f,md)
  end do
  do i = 1, d
    dp(i) = mod(s*k+f,md)
    s = mod(s+dp(i),md)
  end do
  do i = d+1, h
    dp(i) = mod(s*k,md)
    s = mod(s+md-dp(i-d)+dp(i),md)
  end do
  write(*,'(i0)') dp(h)
end program balanced_piles