program divertaB
	integer R, G, B, N, M, count
    integer L1I, L2I, i, j, L1, L2, L3
    count = 0
    read(*, *) R, G, B, N
    L1 = MAX(R, G, B)
    L3 = min(R, G, B)
    L2 = R + G + B - L1 - L3
    L1I = int(N/L1) + 1
     DO 10 i = 0, L1I
     L2I = int((N-i)/L2) + 1
     if (L2I.GE.0) then
      DO 20 j = 0, L2I
        M = N - L1*i - L2*j
        if (M.GE.0) then
         if (mod(M, L3)==0) then
       count = count + 1
        end if
       end if
      20 continue
      end if
      10 continue
    print '(i0)', count
end program