mod=1000000007
def mi(a,m)
  b,u,v=m,1,0
  while b>0
    t=a/b
    a-=t*b
    u-=t*v
    a,b,u,v=b,a,v,u
  end
  u%=m
  u+=m if u<0
  return u
end
s=gets.to_i
f=[1]
s.times do |i|
  f << f[-1]*(i+1)%mod
end
a=0
1.upto(s/3) do |i|
  a=(a+f[s-3*i+i-1]*mi(f[s-3*i],mod)*mi(f[i-1],mod))%mod
end
puts a
