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



count = 0

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

    n = N - R * i

    for j in range(n // G + 1):

        if (n - G*j) >= 0 and (n - G*j) % B == 0:

            count += 1



print(count)

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



tmp = [R, G, B]

tmp.sort()

R, G, B = tmp[2], tmp[1], tmp[0]





num_R = N // R + 1

num_G = N // G

RG = [[N - R*i for i in range(num_R)]]



for j in range(num_G):

    RG.append([RG[-1][i] - G for i in range(num_R)])



check = lambda x: 0 if x < 0 else 1 if x == 0 else 1 if x%B == 0 else 0



a = []

count = 0

for i in range(len(RG)):

    a = list(map(check, RG[i]))

    count += sum(a)



print(count)

R, G, B, N = list(map(int, input().split()))
count = 0
for i in range(N // R + 1):
    n = N - R * i
    for j in range(n // G + 1):
        if (n - G * j) >= 0 and (n - G * j) % B == 0:
            count += 1
print(count)

R, G, B, N = list(map(int, input().split()))
tmp = [R, G, B]
tmp.sort()
R, G, B = tmp[2], tmp[1], tmp[0]
num_R = N // R + 1
num_G = N // G
RG = [[N - R * i for i in range(num_R)]]
for j in range(num_G):
    RG.append([RG[-1][i] - G for i in range(num_R)])
check = lambda x: 0 if x < 0 else 1 if x == 0 else 1 if x % B == 0 else 0
a = []
count = 0
for i in range(len(RG)):
    a = list(map(check, RG[i]))
    count += sum(a)
print(count)

+tmp = [R, G, B] +tmp.sort() +R, G, B = tmp[2], tmp[1], tmp[0] +num_R = N // R + 1 +num_G = N // G +RG = [[N - R * i for i in range(num_R)]] +for j in range(num_G): +    RG.append([RG[-1][i] - G for i in range(num_R)]) +check = lambda x: 0 if x < 0 else 1 if x == 0 else 1 if x % B == 0 else 0 +a = [] -for i in range(N // R + 1): -    n = N - R * i -    for j in range(n // G + 1): -        if (n - G * j) >= 0 and (n - G * j) % B == 0: -            count += 1 +for i in range(len(RG)): +    a = list(map(check, RG[i])) +    count += sum(a)