program redistribution
  implicit none
  integer(8), parameter :: modu = 1000000007
  integer :: s, i
  integer(8) :: dp(2000) = 0
  read(*,*) s
  dp(3) = 1
  do i = 4, s
    dp(i) = mod(dp(i - 1) + dp(i - 3), modu)
  end do
  write(*,'(i0)') dp(s)
end program redistribution