*lst,N = list(map(int, input().split()))



lst.sort(reverse=True)

#print(lst)

count = 0

for i in range(N // lst[0] + 1):

    for j in range((N - i * lst[0]) // lst[1] + 1):

        if (N - i * lst[0] - j * lst[1]) % lst[2] == 0:

            count += 1

print(count)

r,g,b,n = list(map(int,input().split()))

a = [0]*(n+1)

a[0] = 1

for j in range(0,n+1-r,r):

    a[j+r]=1

for j in range(n+1-b):

    a[j+b]+=a[j]

for j in range(n+1-g):

    a[j+g]+=a[j]

    #print(a)

print((a[n]))

*lst, N = list(map(int, input().split()))
lst.sort(reverse=True)
# print(lst)
count = 0
for i in range(N // lst[0] + 1):
    for j in range((N - i * lst[0]) // lst[1] + 1):
        if (N - i * lst[0] - j * lst[1]) % lst[2] == 0:
            count += 1
print(count)

r, g, b, n = list(map(int, input().split()))
a = [0] * (n + 1)
a[0] = 1
for j in range(0, n + 1 - r, r):
    a[j + r] = 1
for j in range(n + 1 - b):
    a[j + b] += a[j]
for j in range(n + 1 - g):
    a[j + g] += a[j]
    # print(a)
print((a[n]))

-*lst, N = list(map(int, input().split())) -lst.sort(reverse=True) -# print(lst) -count = 0 -for i in range(N // lst[0] + 1): -    for j in range((N - i * lst[0]) // lst[1] + 1): -        if (N - i * lst[0] - j * lst[1]) % lst[2] == 0: -            count += 1 -print(count) +r, g, b, n = list(map(int, input().split())) +a = [0] * (n + 1) +a[0] = 1 +for j in range(0, n + 1 - r, r): +    a[j + r] = 1 +for j in range(n + 1 - b): +    a[j + b] += a[j] +for j in range(n + 1 - g): +    a[j + g] += a[j] +    # print(a) +print((a[n]))