CodeEff/ECCO huggingface dataset:
# Original solution
*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)


# Optimized solution
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]))
# Original solution
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]))


# Optimized solution
r,g,b,n = list(map(int,input().split()))
a = [0]*(n+1)
a[0] = 1
for j in range(n+1-r):
    a[j+r]=a[j]
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]))
# Original solution
R, G, B, n = list(map(int, input().split()))
cnt = 0
for r in range(int(n//R)+1):
  for g in range(int(n//G)+1):
    
      if (n - (r*R + g*G)) % B == 0 and n - (r*R + g*G) >= 0:
        
        cnt +=1
print(cnt)

# Optimized solution
R, G, B, n = list(map(int, input().split()))
cnt = 0
for r in range((n//R)+1):
  for g in range((n//G)+1):
    
      if (n - (r*R + g*G)) % B == 0 and n - (r*R + g*G) >= 0:
        
        cnt +=1
print(cnt)
# Original solution
r, g, b, n = list(map(int, input().split()))
ans=0
for i in range(3001):
    for j in range(3001):
        if n-(r*i+g*j)>=0 and (n-(r*i+g*j))%b==0:
            ans+=1
print(ans)

# Optimized solution
r, g, b, n = list(map(int, input().split()))
ans=0
for i in range(n//r+1):
    for j in range(n-r*i+1):
        p=n-(r*i+g*j)
        if p>=0 and p%b==0:
            ans+=1
print(ans)
# Original solution
r,g,b,n=list(map(int,input().split()))
tmp=0
A=0
B=0
for i in range(3001):
    if(r*i>3001):break
    for j in range(3001):
        A=r*i+g*j
        B=n-A
        if(A>3001|B<0):break
        if(((B%b)==0)&((B/b)<3001)):
            tmp+=1
print(tmp)

# Optimized solution
R, G, B, N = list(map(int, input().split()))
 
ans = 0
for r in range(N//R + 1):
    for g in range((N - (R*r))//G + 1):
        if(N - (R*r) - (G*g)) % B == 0:
            ans += 1
print(ans)
# Original solution
def main():
    R, G, B, N = (int(i) for i in input().split())
    ans = 0
    for r in range(0, N+1):
        for g in range(0, N+1):
            b = (N - r*R - g*G)//B
            if b >= 0 and r*R + g*G + b*B == N:
                ans += 1
    print(ans)


if __name__ == '__main__':
    main()


# Optimized solution
def main():
    R, G, B, N = (int(i) for i in input().split())
    ans = 0
    for r in range(N+1):
        for g in range(N+1):
            need = N - r*R - g*G  # 必要ボール数
            if need < 0:
                continue
            b = 0--need//B
            if r*R + g*G + b*B == N:
                ans += 1
                # print(r, g, b)
    print(ans)


if __name__ == '__main__':
    main()
# Original solution
R, G, B, N = list(map(int, input().split()))

ans = 0
for r in range(0, N+1):
    balls = R*r
    if N < balls:
        break
    for g in range(0, N+1):
        balls = R*r + G*g
        if N < balls:
            break
        left = N - balls
        if left % B == 0:
            ans += 1

print(ans)


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

ans = 0
rsum = 0
for r in range(0, N+1):
    if N < rsum:
        break
    rgsum = rsum
    for g in range(0, N+1):
        if N < rgsum:
            break
        left = N - rgsum
        if left % B == 0:
            ans += 1
        rgsum += G
    rsum += R

print(ans)
# Original solution
R,G,B,N = list(map(int,input().split()))
count = 0
for a in range(N+1):
    for b in range(N-a+1):
        c = N-a-b
        if a%R == 0 and b%G == 0 and c%B == 0:
            count +=1
print(count)

# Optimized solution
R,G,B,N = list(map(int,input().split()))
count = 0
for a in range(0,N+1,R):
    for b in range(0,N-a+1,G):
        c = N-a-b
        if a%R == 0 and b%G == 0 and c%B == 0:
            count +=1
print(count)
# Original solution
R,G,B,N = list(map(int,input().split()))
count = 0
for a in range(0,N+1,R):
    for b in range(0,N-a+1,G):
        c = N-a-b
        if a%R == 0 and b%G == 0 and c%B == 0:
            count +=1
print(count)

# Optimized solution
R,G,B,N = list(map(int,input().split()))
count = 0
for a in range(0,N+1,R):
    if a%R == 0:
        for b in range(0,N-a+1,G):
            if b%G == 0:
                c = N-a-b
                if c%B == 0:
                    count +=1
print(count)
# Original solution
R,G,B,N=list(map(int,input().split()))

ans=[]

for r in range(int(N/R)+1):
    for g in range(int((N-r*R)/G)+1):
        b=((N-r*R-g*G)/B)
        if b.is_integer():
            ans.append([r,g,b])

print((len(ans)))

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

ans=[]

count=0
for r in range(int(N/R)+1):
    for g in range(int((N-r*R)/G)+1):
        
        if (N-r*R-g*G)%B==0:
            count+=1
            #ans.append([r,g,(N-r*R-g*G)/B])

#print(ans)
print(count)
# Original solution
R, G, B, N = list(map(int, input().split()))

res = 0
for i in range(N // R + 1):
    for j in range(N // G + 1):
        b = N - (i * R + j * G)
        if b >= 0 and b % B == 0:
            res += 1
print(res)


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

res = 0
for i in range(N // R + 1):
    for j in range((N - i * R) // G + 1):
        if (N - (i * R + j * G)) % B == 0:
            res += 1

print(res)
# Original solution
#! /usr/bin/env python3
# -*- coding: utf-8 -*-

R,G,B,N =[int(x) for x in input().split()]
a = 0
for i in range(N//R+1):
    for j in range(((N-(i*R))//G)+1):
        if N -i*R-j*G >=0 and (N -i*R-j*G)%B == 0:
            a += 1
                       
           

print(a)

# Optimized solution
#! /usr/bin/env python3
# -*- coding: utf-8 -*-

R,G,B,N =[int(x) for x in input().split()]
a = 0
for i in range(N//R+1):
    for j in range(((N-(i*R))//G)+1):
        if (N -i*R-j*G)%B == 0:
            a += 1
                       
           

print(a)
# Original solution
r,g,b,N=list(map(int,input().split()))
c=0
for i in range(N//r+1):
    for j in range(N//g + 1):
        t = (N-i*r-j*g)
        if t%b ==0 and t>=0:
            #print(i,j,t//b)
            c+=1
print(c)

# Optimized solution
*s,n=list(map(int,input().split()))
s.sort()
c=0
for i in range(n//s[2]+1):
    for j in range(n//s[1]+1):
        if (n-s[2]*i-s[1]*j)%s[0] == 0 and 0<=(n-s[2]*i-s[1]*j):
            #print(i,j,n-s[2]*i-s[1]*j)
            c+=1
print(c)
# Original solution
R,G,B,N=list(map(int,input().split()))
ans=0
for r in range(0,int(N//R)+1):
    for g in range(0,int(N//G)+1):
        if (N-R*r-G*g)%B==0 and R*r+G*g<=N:
            ans+=1
            #print(r,g)
print(ans)

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

cnt=0
for i in range(N//R +2):
    if R*i>N:
        break
    for j in range((N-R*i)//G +2):
        if R*i+G*j>N:
            break
        if (N-(R*i+G*j))%B==0:
            cnt+=1

print(cnt)


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

cnt=0
for i in range(N//R+1):
    for j in range((N-R*i)//G+1):
        if (N-(R*i+G*j))%B==0:
            cnt+=1

print(cnt)
# Original solution
R,G,B,N = list(map(int,input().split()))
ans = 0
#R>G and G>B
if R<B:
  x = R
  R = B
  B = x
for r in range(N+1):
  if r*R>N:
    break
  for g in range(N+1):
    if r*R+g*G>N:
      break
    if (N-r*R-g*G)%B==0:
      ans+=1
print(ans)

# Optimized solution
R,G,B,N = list(map(int,input().split()))
ans = 0
for r in range(N+1):
  if r*R>N:
    break
  for g in range(N+1):
    S = N-r*R-g*G
    if S<0:
      break
    elif S%B==0:
      ans+=1
print(ans)
# Original solution
import math
R,G,B,N = list(map(int,input().split()))
cnt = 0
for i in range(math.ceil(N/G)+1):
	for j in range(math.ceil(N/R)+1):
			tmp = N - i * G - j * R
			if  tmp >=0 and tmp % B == 0:
				cnt += 1
print(cnt)

# Optimized solution
import math
R,G,B,N = list(map(int,input().split()))
cnt = 0
for i in range(math.ceil(N/G)+1):
	for j in range(math.ceil(N/R)+1):
			tmp = N - i * G - j * R
			if tmp < 0:
				break
			if tmp % B == 0:
				cnt += 1
print(cnt)
# Original solution
r, g, b, n = list(map(int, input().split()))
c = sorted([r, g, b])[::-1]
ans = 0
for i in range(n // c[0] + 1):
    for j in range((n - i * r) // c[1] + 1):
        x = n - i * c[0] - j * c[1]
        if x >= 0 and x % c[2] == 0:
            ans += 1
print(ans)


# Optimized solution
r, g, b, n = list(map(int, input().split()))
c = sorted([r, g, b])[::-1]
ans = 0
for i in range(n // c[0] + 1):
    x = n - i * c[0]
    for j in range(x // c[1] + 1):
        y = x - j * c[1]
        if y < 0:
            break
        elif y % c[2] == 0:
            ans += 1
print(ans)
# Original solution
r,g,b,n=list(map(int,input().split()))
ans=0
for i in range(int(n/r)+1):
    for j in range(int((n-(i*r))/g)+1):
        num=(n-(i*r+j*g))%b
        if num==0 and n-(i*r+j*g)>=0:
            ans+=1
print(ans)


# Optimized solution
def solve():
    r,g,b,n=list(map(int,input().split()))
    ans=0
    for i in range(int(n/r)+1):
        for j in range(int((n-(i*r))/g)+1):
            num=n-(i*r+j*g)
            if num%b==0 and num>=0:
                ans+=1
    print(ans)
solve()
# Original solution
R,G,B,n=list(map(int,input().split()))
c=0
for i in range(n+1):
    r=R*i
    if r>n:
        break
    for j in range(n+1):
        g=G*j
        if r+g>n:
            break
        b=n-r-g
        if b%B==0:
            c+=1
print(c)


# Optimized solution
R,G,B,n=list(map(int,input().split()))
def cou(R,G,B,n):
    c=0
    for i in range(n+1):
        r=R*i
        if r>n:
            break
        for j in range(n+1):
            g=G*j
            if r+g>n:
                break
            b=n-r-g
            if b%B==0:
                c+=1
    return c
print((cou(R,G,B,n)))
# Original solution
r,g,b,n=list(map(int,input().split()))
ans=0
for i in range(n//r+1):
    for j in range(n//g+1):
        if (n-(r*i+g*j))%b==0:
            if (n-(r*i+g*j))//b>=0:
                ans+=1
print(ans)

# Optimized solution
a,b,c,d=list(map(int,input().split()))
ans=0
for x in range(d//a+1):
    for y in range(d//b+1):
#        print(x,y,(d-(x*a+y*b))//c)
        if (d-(x*a+y*b))%c==0 and (d-(x*a+y*b))>=0:
            ans+=1
print(ans)
# Original solution
r,g,b,n = list(map(int,input().split()))
cnt = 0
for i in range(n // r + 1):
    for j in range(n // g + 1):
        c = n - i * r - j * g
        if c % b == 0 and c >= 0:
             cnt += 1
print(cnt)


# Optimized solution
r,g,b,n = list(map(int,input().split(" ")))
cnt = 0
for i in range(n // r + 1):
    for j in range(n // g + 1):
        c = n - i * r - j * g
        if c < 0:
            break
        if c % b == 0:
             cnt += 1
print(cnt)
# Original solution
r, g, b, n = list(map(int, input().split()))
cnt = 0
for i in range(n // r + 1):
    for j in range((n - i) // g + 1):
        k = (n - i * r - j * g) / b
        if k >= 0 and k // 1 == k:
            cnt += 1
print(cnt)

# Optimized solution
r, g, b, n = list(map(int, input().split()))
cnt = 0
for i in range(0, n + 1, r):
    for j in range(0, n - i + 1, g):
        if (n - i - j) % b == 0:
            cnt += 1
print(cnt)
# Original solution
R, G, B, N = list(map(int, input().split()))
number = [R, G, B]
number = sorted(number)
M = N // number[2]
ans = 0

for i in range(0, M+1):
    value1 = i * number[2]
    L = (N-value1) // number[1]
    for j in range(0, L+1):
        value2 = j * number[1]
        if N-value1-value2 >= 0 and (N-value1-value2) % number[0] == 0:
            ans += 1
            continue

print(ans)

# Optimized solution
R, G, B, N = list(map(int, input().split()))
number = [R, G, B]
number = sorted(number)
M = N // number[2]
ans = 0

if number[2] == 1:
    print(((N+2)*(N+1)//2))
else:
    for i in range(0, M+1):
        value1 = i * number[2]
        L = (N-value1) // number[1]
        for j in range(0, L+1):
            value2 = j * number[1]
            if N-value1-value2 >= 0 and (N-value1-value2) % number[0] == 0:
                ans += 1
                continue
    
    print(ans)
# Original solution
#B問題
R, G, B, N = list(map(int, input().split()))

ans = 0
for r in range(0, N // R + 1):
    for g in range(0, N // G + 1):
        if (N - R*r - G*g) % B == 0 and (N - R*r - G*g)/B >=0:
            ans += 1
print(ans)            

# Optimized solution
#B問題
import math
R, G, B, N = list(map(int, input().split()))

ans = 0
if R == G == B == 1:
    print((int((N+2)*(N+1)/2)))
else:
    for r in range(0, N // R + 1):
        for g in range(0, N // G + 1):
            if (N - R*r - G*g) % B == 0 and (N - R*r - G*g)/B >=0:
                ans += 1
    print(ans)
# Original solution
R, G, B, N = list(map(int, input().split()))
r = 0
g = 0
X = N - r*R - g*G
num = 0
while X >= 0:
	while X >= 0:
			if X % B == 0:
				num += 1
			r += 1
			X = N - r*R - g*G
	g += 1
	r = 0
	X = N - r * R - g * G
 
print(num)

# Optimized solution
R,G,B,N = list(map(int, input().split()))
count = 0
for r in range(N // R + 1) :
    for g in range((N - r*R) // G + 1) :
        if (N - r*R - g*G) %B == 0 :
            count += 1
print(count)
# Original solution
R, G, B, N = list(map(int, input().split()))

count = 0

len_r = N // R + 2
len_g = N // G + 2
for ix in range(len_r):
    for iy in range(len_g):
        sum = N - (R * ix + G * iy)
        if sum >= 0 and sum % B == 0:
            count += 1
        if R * ix + G + iy > N:
            break

print(count)

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

count = 0

len_r = N // R + 2
for ix in range(len_r):
    len_g = (N - (R * ix)) // G + 2
    for iy in range(len_g):
        t = N - (R * ix + G * iy)
        if t >= 0 and t % B == 0:
            count += 1
print(count)
# Original solution
# coding: utf-8
# Your code here!
R, G, B, N = list(map(int, input().split()))
answer = 0
for x in range(N // R + 1):
	for y in range(N // G + 1):
		if (N - R * x - G * y) % B == 0 & 0 <= (N - R * x - G * y) // B <= N // B:
			answer += 1
print(answer)

# Optimized solution
# coding: utf-8
# Your code here!
R, G, B, N = list(map(int, input().split()))

answer = 0
for r in range(N//R + 1):
    for g in range((N - r*R)//G + 1):
        if (N-r*R-g*G) % B == 0:
            answer += 1

print(answer)
# Original solution
r, g, b, n = list(map(int, input().split()))
ans = 0
nr = n // r
ng = n // g
for i in range(nr + 1):
    for j in range(ng + 1):
        tmp = n - i * r - j * g
        if tmp % b == 0 and tmp >= 0:
            ans += 1
print(ans)


# Optimized solution
r, g, b, n = list(map(int, input().split()))
ans = 0
nr = n // r
ng = n // g
for i in range(nr + 1):
    for j in range(ng + 1):
        tmp = n - i * r - j * g
        if tmp >= 0 and tmp % b == 0:
            ans += 1
print(ans)
# Original solution
ans = 0
R, G, B, N = list(map(int, input().split()))
for r in range(N//R + 1):
  for g in range(N//G + 1):
    rg = r*R + g*G
    if rg <= N and (N-rg)%B == 0:
      ans += 1
print(ans)

# Optimized solution
ans = 0
R, G, B, N = list(map(int, input().split()))
rl = (N+R-1)//R+1
gl = (N+G-1)//G+1
bl = (N+B-1)//B
for r in range(rl):
  for g in range(gl):
    tmp = N - (r*R) - (g*G)
    if tmp < 0:
      break
    if tmp == 0:
      ans += 1
    elif tmp%B == 0 and tmp%B <= bl:
      ans += 1
print(ans)
# Original solution
r,g,b,n = list(map(int,input().split()))
cnt = 0
for i in range(0,n//r + 1):
    for j in  range(0,n//g + 1):
        if (n - i*r - j*g)%b == 0 and (n - i*r - j*g)/b >= 0:
            cnt += 1
print(cnt)

# Optimized solution
r,g,b,n = list(map(int,input().split()))
cnt = 0
for i in range(0,n+1,r):
    for j in range(0,n+1-i,g):
        if (n - i - j)%b == 0 and (n - i - j)%b >= 0:
            cnt += 1
print(cnt)
# Original solution
r,g,b,n = list(map(int, input().split()))
ans = 0
for i in range((n+1)//r+1):
    for j in range((n+1)//g+1):
        k = n - (i*r + j*g)
        if k < 0:
            break
        elif k >= 0 and k%b == 0:
            ans += 1
print(ans)


# Optimized solution
r,g,b,n = list(map(int, input().split()))
ans = 0
for i in range(n+1):
    for j in range(n+1):
        k = n - (i*r + j*g)
        if k < 0:
            break
        elif k >= 0 and k%b == 0:
            ans += 1
print(ans)
# Original solution
r,g,b,n=list(map(int,input().split()))

lst=[r,g,b]
lst.sort()
r=lst[2]
g=lst[1]
b=lst[0]

rlim=n//r
glim=n//g
blim=n//b

"""
blist = [i*b for i in range(blim+1)]

glist = [i*g for i in range(glim+1)]

def binary_search(list, item):
    low = 0
    high = len(list) - 1

    while low <= high:
        mid = (low + high) //2
        guess = list[mid]
        if guess == item:
            return True
        if guess > item:
            high = mid -1
        else:
            low = mid + 1
    return False
"""

cnt=0

for i in range(rlim+1):
    glim=(n-i*r)//g
    for j in range(glim+1):
        if (n-i*r-j*g)%b==0:
            cnt+=1
print(cnt)

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

lst = [r, g, b]
lst.sort()
r = lst[2]
g = lst[1]
b = lst[0]

rlim = n//r
glim = n//g

cnt = 0

for i in range(rlim+1):
    glim = (n-i*r)//g
    for j in range(glim+1):
        if (n-i*r-j*g) % b == 0:
            cnt += 1
print(cnt)
# Original solution
r,g,b,n = list(map(int, input().split()))
ans = 0
rgb = sorted([r,g,b])
n_rgb = []
for e in rgb:
  n_rgb.append(n//e)
for i in range(n_rgb[2]+1):
  for j in range(n_rgb[1]+1):
    N = n - i*rgb[2] - j*rgb[1]
    if  N>=0 and N%rgb[0]==0:
      ans+=1
      
print(ans)

# Optimized solution
r,g,b,n = list(map(int, input().split()))
ans = 0
rgb = sorted([r,g,b])
n_rgb = []
for e in rgb:
  n_rgb.append(n//e)
for i in range(n_rgb[2]+1):
  N2 = n-i*rgb[2]
  for j in range(n_rgb[1]+1):
    N = N2 - j*rgb[1]
    if  N>=0 and N%rgb[0]==0:
      ans+=1
      
print(ans)
# Original solution
r,g,b,n = list(map(int,input().split()))
r1 = 0
count = 0

while r*r1 <= n:
    g1 = 0
    while r*r1+g*g1 <= n:
        if (n-(r*r1+g*g1))%b==0:
            count += 1
        g1 += 1
    r1 += 1
print(count)


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

ans = 0

for r in range(1+N//R):
    for g in range(1+N//G):
        #print(N-(r*R+g*G),r*R, g*G)
        if N-(r*R+g*G) < 0:
            break
        if (N-(r*R+g*G))%B==0:
            ans += 1
print(ans)
# Original solution
# -*- coding: utf-8 -*-
# 標準入力の取得
R, G, B, N = list(map(int, input().split()))

# 求解処理
r_max = N // R
g_max = N // G
result = 0
for r in range(r_max+1):
    n_r = r * R
    for g in range(g_max+1):
        n_rg = n_r + g*G
        if N < n_rg:
            continue
        if (N - n_rg) % B == 0:
            result += 1


# 結果出力
print(result)


# Optimized solution
# -*- coding: utf-8 -*-
# 標準入力の取得
R, G, B, N = list(map(int, input().split()))


def main() -> None:
    # 求解処理
    r_max = N // R
    g_max = N // G
    result = 0
    for r in range(r_max+1):
        n_r = r * R
        for g in range(g_max+1):
            n_rg = n_r + g*G
            if N < n_rg:
                continue
            if (N - n_rg) % B == 0:
                result += 1

    # 結果出力
    print(result)


if __name__ == "__main__":
    main()
# Original solution
R, G, B, N = list(map(int, input().split()))
ans = 0
for r in range(N//R+2):
    for g in range((N-r*R)//G+2):
        if N - r*R - g*G >= 0 and (N - r*R - g*G) % B == 0:
            ans += 1
print(ans)

# Optimized solution
R, G, B, N = list(map(int, input().split()))
ans = 0
for r in range(N//R+1):
    for g in range((N-r*R)//G+1):
        if (N - r*R - g*G) % B == 0:
            ans += 1
print(ans)
# Original solution
R,G,B,N=list(map(int, input().split()))
count=0
for p1 in range(0,N+1,R):
    for p2 in range(0,N-p1+1,G):
        rR = p1
        gG = p2
        bB = N-p1-p2
        if rR%R==0 and gG%G==0 and bB%B==0:
            count+=1
print(count)

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

count=0
for p1 in range(0,N+1,R):
    for p2 in range(0,N-p1+1,G):
        rR = p1
        gG = p2
        bB = N-p1-p2
        if bB%B==0:
            count+=1
print(count)
# Original solution
r,g,b,n = list(map(int, input().split()))
count = 0
c0,c1,c2 = sorted([r,g,b])
for i in range(1+n//c2):
    rest1 = n - i*c2
    if rest1 < 0:
        break
    for j in range(1+rest1//c1):
        rest = n - i*c2 - j*c1
        if rest <0:
            break
        if rest%c0 == 0 and rest >= 0:
            count += 1
print(count)

# Optimized solution
r,g,b,n = list(map(int, input().split()))
count = 0
c0,c1,c2 = sorted([r,g,b])
for i in range(1+n//c2):
    rest1 = n - i*c2
    if rest1 < 0:
        break
    for j in range(1+rest1//c1):
        rest = n - i*c2 - j*c1
        if rest <0:
            break
        elif rest%c0 == 0:
            count += 1
print(count)
# Original solution
r,g,b,n=list(map(int, input().split()))

sum=0

for i in range((n//r)+1):
    for j in range((n-(i*r)//g)+1):
        if (n-(i*r)-(j*g))%b==0 and (n-(i*r)-(j*g))//b>=0:
            sum=sum+1
        #    print(i*r,j*g,(n-(i*r)-(j*g))%b)

print(sum)


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

sum=0

for i in range(n//r+1):
    for j in range((n-i*r)//g+1):
        if (n-i*r-j*g)%b==0:
            sum=sum+1
        #    print(i*r,j*g,(n-(i*r)-(j*g))%b)

print(sum)
# Original solution
r, g, b, n = list(map(int,input().split()))
ans = 0

for i in range(n+1):
    if (i*r) > n:
        break
    for j in range(n+1):
        if (i*r) + (j*g) > n:
            break
        if n-(i*r)-(j*g) >= 0 and (n-(i*r)-(j*g))%b == 0:
            ans += 1

print(ans)


# Optimized solution
r, g, b, n = list(map(int,input().split()))
ans = 0

for i in range(n+1):
    x = i*r
    if x > n:
        break
    for j in range(n+1):
        y = j*g
        z = n-x-y
        if x+y > n:
            break
        if z >= 0 and z%b == 0:
            ans += 1

print(ans)
# Original solution
R, G, B, N = list(map(int, input().split()))

cnt = 0

for i in range(N//R + 1) :
    for j in range(N//G + 1) :
        if N - R*i - G*j >= 0 :
            if (N - R*i - G*j) % B == 0:
                cnt += 1

print(cnt)


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

cnt = 0

for i in range(N//R + 1) :
    for j in range((N - R*i)//G + 1) :
        if (N - R*i - G*j) % B == 0:
            cnt += 1

print(cnt)
# Original solution
R, G, B, N =list(map(int, input().split()))
# R = 13
# G = 1
# B = 4
# N = 3000
X, Y, Z = sorted([R, G, B], reverse=True)
cnt = 0
for i in range(N//X+1):
    for j in range(N+1):
        if (X*i+Y*j>N): break
        cnt += ((N-X*i-Y*j)%Z == 0)
print(cnt)


# Optimized solution
R, G, B, N =list(map(int, input().split()))
# R = 13
# G = 1
# B = 4
# N = 3000
X, Y, Z = sorted([R, G, B], reverse=True)
cnt = 0
for i in range(N//X+1):
    for j in range(N+1):
        tmp = X*i+Y*j 
        if (tmp>N): break
        cnt += ((N-tmp)%Z == 0)
print(cnt)
# Original solution
R,G,B,N = list(map(int, input().split()))
count=0

for i in range(N//R+1):
    for j in range(N//G+1):
        if (N-(R*i+G*j))>=0 and (N-(R*i+G*j))%B==0:
            count=count+1
print(count)

# Optimized solution
R,G,B,N = list(map(int, input().split()))
count=0

for i in range(N//R+1):
    for j in range(N//G+1):
        if (N-(R*i+G*j))<0:
            break
        if (N-(R*i+G*j))%B==0:
            count=count+1
print(count)
# Original solution
R,G,B,N = list(map(int,input().split()))
r_max = N//R+1
g_max = N//G+1
b_max = N//B+1
ans = 0
for r in range(r_max):
	g_max = (N-r*R)//G+1
	for g in range(g_max):
		if (N-r*R-g*G)%B == 0 and N-r*R-g*G >= 0:
			ans += 1
print(ans)


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