program divertaB
	integer R, G, B, N, count
    integer L1I, L2I, L3I, i, j, k
    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
      DO 20 j = 0, L2I
       L3I = int((N-i-j)/L3) + 1
       DO 30 k = 0, L3I
       if (N==L1*i+L2*j+L3*k) then
       count = count + 1
       end if
       30 continue
      20 continue
     10 continue
    print '(i0)', count
end program