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
    GI = int(N/G) + 1
    BI = int(N/B) + 1
    DO 10 i = 0, RI
     DO 20 j = 0, GI
      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