PROGRAM ATCODER

implicit none
integer :: r,g,b,n,x,y,z,max_r,max_g,max_b,i,j,count=0

read*, r,g,b,n

max_r = n/r ; max_g = n/g ; max_b = n/b

do i = 0, max_r, 1
  do j = 0, max_g, 1
    x = i ; y = j ; z = (n - x*r - y*g)/b
    if ( mod(n - x*r - y*g,b) == 0 .and. z >=0 .and. z <= max_b ) then
      count = count + 1
    end if
  end do
end do

print'(i0)',  count

END PROGRAM ATCODER