-- editorial

r :: IO [Int]
r = map read . words <$> getLine

main = do
    [_R,_G,_B,_N] <- r
    let r = sum [1 | r<-[0.._N], g<-[0.._N],
                        let b = fromIntegral (_N - r*_R - g*_G) / fromIntegral _B,
                        b >= 0, b == fromIntegral (floor b) ]
    print r

