R,G,B,N = list(map(int,input().split()))



ans = 0





for r in range(N+1) :

    

    for g in range(N+1) :

        if (N - (r*R + g*G)) < 0 : continue

        if (N - (r*R + g*G)) % B == 0 :

            ans += 1

            #print(r,g)

print(ans)

        
R,G,B,N = list(map(int,input().split()))



ans = 0



for r in range(N//R + 1) :

    for g in range((N-r)//G + 1) :

        calc = r*R + g*G

        

        if (N-calc) < 0 :

            break

        

        if (N-calc) % B == 0 :

            ans += 1

print(ans)

R, G, B, N = list(map(int, input().split()))
ans = 0
for r in range(N + 1):
    for g in range(N + 1):
        if (N - (r * R + g * G)) < 0:
            continue
        if (N - (r * R + g * G)) % B == 0:
            ans += 1
            # print(r,g)
print(ans)

R, G, B, N = list(map(int, input().split()))
ans = 0
for r in range(N // R + 1):
    for g in range((N - r) // G + 1):
        calc = r * R + g * G
        if (N - calc) < 0:
            break
        if (N - calc) % B == 0:
            ans += 1
print(ans)

-for r in range(N + 1): -    for g in range(N + 1): -        if (N - (r * R + g * G)) < 0: -            continue -        if (N - (r * R + g * G)) % B == 0: +for r in range(N // R + 1): +    for g in range((N - r) // G + 1): +        calc = r * R + g * G +        if (N - calc) < 0: +            break +        if (N - calc) % B == 0: -            # print(r,g)