solver3::Int->Int->Int->Int->Int
solver3 r g b n = sum [solver2 g b (n-(j*r)) | j<-[0..div n r] ]

solver2::Int->Int->Int->Int
solver2 g b n = sum [solver1 b (n-(j*g)) |j<-[0..div n g]]

solver1::Int->Int->Int
solver1 b n = if mod n b == 0 then 1 else 0

main::IO()
main=do
  (r:g:b:n:[])<-return.map read.words=<<getLine
  print (solver3 r g b n)