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

dp=[0]*(N+1)

dp[0]=1

for C in (R,G,B):

  for i in range(len(dp)-C):

    if dp[i]!=-1:

        dp[i+C]=dp[i]+dp[i+C]

print((dp[N]))

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

dp=[0]*(N+1)

dp[0]=1

for C in (R,G,B):

  for i in range(len(dp)-C):

    dp[i+C]=dp[i]+dp[i+C]

print((dp[N]))

R, G, B, N = list(map(int, input().split()))
dp = [0] * (N + 1)
dp[0] = 1
for C in (R, G, B):
    for i in range(len(dp) - C):
        if dp[i] != -1:
            dp[i + C] = dp[i] + dp[i + C]
print((dp[N]))

R, G, B, N = list(map(int, input().split()))
dp = [0] * (N + 1)
dp[0] = 1
for C in (R, G, B):
    for i in range(len(dp) - C):
        dp[i + C] = dp[i] + dp[i + C]
print((dp[N]))

-        if dp[i] != -1: -            dp[i + C] = dp[i] + dp[i + C] +        dp[i + C] = dp[i] + dp[i + C]