program divertaB
	integer R, G, B, N, count
    integer RI, GI, BI, i, j, k
    count = 0
    read(*, *) R, G, B, N
    RI = int(N/R) + 1
     DO 10 i = 0, RI
     GI = int((N-i)/G) + 1
      DO 20 j = 0, GI
       BI = int((N-i-j)/B) + 1
       DO 30 k = 0, BI
       if (N==R*i+G*j+B*k) then
       count = count + 1
       end if
       30 continue
      20 continue
     10 continue
    print '(i0)', count
end program