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



ans = 0

for b in range(N+1):

    for g in range(N+1):

        if N-B*b-G*g >= 0 and (N-B*b-G*g)%R == 0:

            ans += 1

print(ans)



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



ans = 0

for b in range(N+1):

    for g in range(N+1):

        if N-B*b-G*g < 0:

            break

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

            ans += 1

print(ans)

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

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

-        if N - B * b - G * g >= 0 and (N - B * b - G * g) % R == 0: +        if N - B * b - G * g < 0: +            break +        if (N - B * b - G * g) % R == 0: