program sample
    implicit none
  
    integer(8) :: i,j,m,n,k,a,b,c,d,e
    integer(8),allocatable :: x(:)
  
    read(*,*) a,b,c,n
    
    m=0
    do i=0,n/a
        d=n-a*i
        do j=0,d/b
            e=d-b*j
            if(mod(e,c)==0)then
            	m=m+1
            endif
        end do
    end do

    write(*,*) m
  
    stop
end program sample
  

