program sample
    implicit none
  
    integer(8) :: i,j,m,n,k,a,b,c,d,e,f,y(0:10000)
    integer(8),allocatable :: x(:)
  
    read(*,*) a,b,c,n
    y(:)=0
    m=0
    do i=0,n/a
        do j=0,n/b
            do k=0,n/c
                m=i*a+j*b+k*c
                y(m)=y(m)+1
            enddo
        end do
    end do

    write(*,*) y(n)
  
    stop
end program sample
  

