Problem:
 Score : 200 points    Problem Statement Snuke has come to a store that sells boxes containing balls. The store sells the following three kinds of boxes:   Red boxes, each containing R red balls  Green boxes, each containing G green balls  Blue boxes, each containing B blue balls   Snuke wants to get a total of exactly N balls by buying r red boxes, g green boxes and b blue boxes.
How many triples of non-negative integers (r,g,b) achieve this?      Constraints  All values in input are integers.  1 \leq R,G,B,N \leq 3000         Input Input is given from Standard Input in the following format:  R  G  B  N       Output Print the answer.        Sample Input 1 1 2 3 4      Sample Output 1 4  Four triples achieve the objective, as follows:   (4,0,0)  (2,1,0)  (1,0,1)  (0,2,0)        Sample Input 2 13 1 4 3000      Sample Output 2 87058

Solution (Python):
R, G ,B, N = 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)

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

Solution (Python):
R,G,B,N = 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)

Solution (Python):
R, G, B, N = map(int, input().split(' '))
count = 0
for i in range((N // R)+1):
    for j in range((N // G)+1):
        tmp = N - (R * i + G * j)
        if tmp < 0:
            break
        if tmp == 0:
            count += 1
        elif tmp % B == 0:
            count += 1
print(count)

Solution (Python):
r,g,b,n = 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 and c % b == 0:
             cnt += 1
print(cnt)

Solution (Python):
R,G,B,N=(int(i) for i in input().split())
import math
answer=0
for r in range(0,math.floor(N/R)+1):
    for g in range(math.floor(N/G)+1):
        if R*r+G*g>N:
            break
        if (N-R*r-G*g)%B==0:
            answer+=1

print(answer)

Solution (Python):
R, G, B, N = map(int, input().split())
count = 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:
            count += 1
print(count)

Solution (Python):

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


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


print(ans)

Solution (Python):
r,g,b,n=map(int,input().split())
cnt=0
for i in range(n+1):
        for j in range(n+1):
                z=n-(i*r+j*g)
                if 0<=z and z%b==0:
                        cnt+=1
print(cnt)

Solution (Python):
R, G, B, N = map(int, input().split())
ans = 0
for r in range(N//R+1):
    for g in range(N//G+1):
        if r*R+g*G>N:
            continue
        if (N-r*R-g*G)%B==0:
            ans += 1

print(ans)

Solution (Python):
def main(R, G, B, N):
    arr = [R, G, B]
    arr.sort(reverse=True)
    R, G, B = arr

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

R, G, B, N = (int(i) for i in input().split())
main(R, G, B, N)

Solution (Python):
R, G, B, N = 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)

Solution (Python):

"""
Created on Sun May 12 12:43:56 2019

@author: Yamazaki Kenichi
"""

R,G,B,N = map(int,input().split())
RGB = [R, G, B]

dp = [[0,0,0] for i in range(N+1)]
dp[0] = [1,0,0]
for i in range(1,N+1):
    if R <= i:
        dp[i][0] += dp[i-R][0]
    if G <= i:
        dp[i][1] += (dp[i-G][0] + dp[i-G][1])
    if B <= i:
        dp[i][2] += (dp[i-B][0] + dp[i-B][1] + dp[i-B][2])
print(sum(dp[N]))

Solution (Python):
R,G,B,N = map(int, input().split())
c = 0
for i in range(0,int(N/R)+1):
    for j in range(0,int((N-R*i)/G)+1):
        if (N-R*i-G*j)%B == 0:
            c += 1
print(c)

Solution (Python):
r,g,b,n=list(map(int,input().split()))
cnt=0
for i in range(n+1):
        for j in range(n+1):
                z=n-(i*r+j*g)
                if 0<=z and z%b==0:
                        
                        cnt+=1
print(cnt)

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

a1, a2, a3 = sorted([r, g, b])
ans = 0
a3n = n // a3
a2n = n // a2
for i in range(a3n + 1):
    for j in range(a2n + 1):
        r = n - (a3 * i + a2 * j)
        if r < 0:
            break
        if r % a1 == 0:
            ans += 1

print(ans)

Solution (Python):
from collections import defaultdict
import math


def kari():
    map(int, input().split())
    list(map(int, input().split()))
    math.ceil()

def main():
    red, green, blue, num = map(int, input().split())
    ans = 0
    for i in range(num + 1):
        for j in range(num + 1):
            nokori = num - red * i - blue * j
            if nokori < 0:
                break
            if nokori % green == 0:
                
                ans += 1
        if num < red * i:
            break
    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):

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

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

print(ans)

Solution (Python):
R, G, B, N = 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)

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

Solution (Python):
R,G,B,N = map(int,input().split())
ans = 0
for r in range(N//R + 1) :
    for g in range((N-r)//G + 1) :
        calc = r*R + g*G
        if N < calc :
            break
        if not (N-calc) % B :
            ans += 1
print(ans)

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

Solution (Python):
import sys
input = sys.stdin.readline

R, G, B, N = (int(i) for i in input().split())


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

Solution (Python):
R,G,B,N = map(int,input().split())

ans = 0

for r in range(N//R + 1) :
    for g in range((N-r)//G + 1) :
        calc = r*R + g*G
        
        if (N-calc) < 0 :
            break
        
        if (N-calc) % B == 0 :
            ans += 1
print(ans)

Solution (Python):
R, G, B, N = map(int, input().split())
ans = 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:
        ans += 1
print(ans)

Solution (Python):
r,g,b,n=map(int,input().split())
cnt=0
for i in range(0,n+1):
    for j in range(0,n-i+1):
        bb=n-(i*r+j*g)
        s=bb+i*r+j*g
        if bb<0:
            continue
        if s==n and bb%b==0:
            cnt+=1
        if j*g>n or i*r>n or s-bb>n:break
    if i*r>n:break
print(cnt)

Solution (Python):
x = [0] * 3
x[0], x[1], x[2], N = map(int, input().split())
A = [[0]*(N+1) for _ in range(4)]
A[0][0] = 1

for k in range(3):
    for i in range(N+1):
        j = 0
        while i + x[k] * j <= N:
            A[k+1][i + x[k] * j] += A[k][i]
            j += 1

print(A[3][N])

Solution (Python):
R,G,B,N=[int(i) for i in input().split()]
num = 0
for i in range(N//R+1):
  for j in range(N//G+1):

    if i*R+j*G<=N:
      if (N-i*R-j*G)%B==0:

        num+=1
print(num)

Solution (Python):


import sys
import copy

sys.setrecursionlimit(1000000)





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

ans = 0
for r in range(3001):
    for g in range(3001):
        ball = r * R + g * G
        d = N - ball
        if d >= 0 and d % B == 0:
            ans += 1
        
        

print(ans)

Solution (Python):
R,G,B,N=map(int,input().split())
count=0
wa=0
for i in range(int(N/R)+1):
    for j in range(int((N-i*R)/G)+1):
        b=(N-i*R-j*G)/B
        if b>=0 and float.is_integer(b)==True:
            count=count+1
     
print(count)

Solution (Python):
r,g,b,n = map(int,input().split())
ans = 0

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

print(ans)

Solution (Python):


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

    
    
    ans = 0
    for g in range(N+1):
        if g*G > N: break
        for b in range(N+1):
            if g*G+b*B > N: break
            if (N - (g*G+b*B))%R == 0:
                ans += 1
    print(ans)


if __name__ == "__main__":
    solve()

Solution (Python):
R, G, B, N=map(int, input().split())
cnt=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:
            cnt+=1
print(cnt)

Solution (Python):


import sys
def p(*a):
  s=" ".join(map(str,a))
  
  sys.stderr.write(s+"\n")


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


r=g=b=0
ans=0






for r in range(N//R+2):
	if (R*r)>N: break

	for g in range(N//G+2):
		if (R*r)+(G*g)>N:
			break
			X.append("break")
		
		b = (N-(R*r)-(G*g))//B
		n = (R*r)+(G*g)+(B*b)
		if n==N:
			ans+=1



print(ans)

Solution (Python):

a = list(map(int,input().split())) 
n = a[3]
a = a[:3]
range_r = n//a[0]+1
range_g = n//a[1]+1
cnt = 0
for r in range(range_r):
  for g in range((n-r*a[0])//a[1]+1):
    rg = r*a[0]+g*a[1]
    if (n - rg)%a[2]==0:
      cnt += 1

print(cnt)

Solution (Python):
r,g,b,n = map(int,input().split())
cnt = 0
for x in range(n+1):
    for y in range(n+1):
        z = n-r*x-g*y
        if z >= 0 and z%b == 0:
            cnt += 1
print(cnt)

Solution (Python):
R, G, B, N = map(int, input().split())
l = sorted([R, G, B])[::-1]

count = 0
for l0 in range(N//l[0]+1):
  n0 = N-l0*l[0]
  for l1 in range(n0//l[1]+1):
    l2 = n0 - l1*l[1]
    if l2%l[2] == 0 and l2 >= 0:
      count += 1
print(count)

Solution (Python):
R,G,B,N=map(int,input().split())
A=[0]*(N+1)
A[0]=1
for i in range(N+1-R):
    A[i+R]=A[i]
for k in range(N+1-G):
    A[k+G]+=A[k]
for h in range(N+1-B):
    A[h+B]+=A[h]
print(A[N])

Solution (Python):

R, G, B, N = map(int, input().split())
R, G, B = list(sorted([R, G, B], reverse=True))
ans = 0
for r in range(N + 1):
    for g in range(N + 1):
        if (N - (r * R + g * G)) % B != 0:
            continue
        b = (N - (r * R + g * G))/B
        if b < 0:
            break
        if r * R + g * G + b * B == N:
            ans += 1
        elif r * R + g * G + b * B > N:
            break

print(ans)

Solution (Python):
A,B,C,N=map(int, input().split())
count=0
for x in range(N+1):
  for y in range(N-x*A+1):
    b=(N-x*A-y*B)
    if b>=0 and b%C==0:
      count+=1
                
print(count)

Solution (Python):
def trans(n, dp, color):
    for i in range(n-color+1):
        dp[i+color] += dp[i]
    return dp

def main():
    r, g, b, n = [int(i) for i in input().split()]
    dp = [0 for i in range(n+1)]
    dp[0] = 1
    dp = trans(n, dp, r)
    dp = trans(n, dp, g)
    dp = trans(n, dp, b)
    print(dp[-1])

main()

Solution (Python):
r,g,b,n = map(int, input().split(" "))
l = sorted([r,g,b])
count=0
for i in range(n+1):
    for j in range(n+1):
        x = l[2]*i
        y = l[1]*j
        if (n-x-y) >= 0 and (n-x-y)%l[0] == 0:
            count = count + 1
print(count)

Solution (Python):
r,g,b,n = map(int, input().split(" "))
l = sorted([r,g,b])
count=0
for i in range(int(n/l[2])+1):
    for j in range(int(n/l[1])+1):
        x = l[2]*i
        y = l[1]*j
        if (n-x-y) < 0:
            break
        if (n-x-y) >= 0 and (n-x-y)%l[0] == 0:
            count = count + 1
print(count)

Solution (Python):
r,g,b,n = map(int, input().split(" "))
l = sorted([r,g,b])
count=0
for i in range(int(n/l[2])+1):
    for j in range(int(n/l[1])+1):
        x = l[2]*i
        y = l[1]*j
        if (n-x-y) >= 0 and (n-x-y)%l[0] == 0:
            count = count + 1
print(count)

Solution (Python):

def input_from_console():
    r, g, b, n = map(int, input().split())

    return r, g, b, n


def main():
    r, g, b, n = input_from_console()
    counter = 0
    r, g, b = sorted([r, g, b], reverse=True)
    for i1 in reversed(range(int(n / r) + 1)):
        n1 = n - r * i1
        for i2 in reversed(range(int(n1 / g) + 1)):
            n2 = n1 - g * i2
            if n2 % b == 0:
                counter += 1
    print(counter)


if __name__ == "__main__":
    main()

Solution (Python):
import math
r,g,b,n = map(int, input().split())
count = 0
r,g,b = sorted((r,g,b), reverse=True)
for x in range( math.ceil((n / r)) + 1):
    for y in range( math.ceil( (n - (r*x) ) / g) + 1):
        if (n - (r*x) - (y*g)) < 0:
            break
        if ((n - (r*x) - (g * y)) % b) == 0:
            count = count + 1
print(count)

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

Solution (Python):
import sys

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [sys.stdin.readline() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))



def main():
    R, G, B, N = i2nn()
    
    cnt = 0
    R, G, B = sorted((R, G, B), reverse=True)
    for r in range(N // R + 1):
        for g in range((N - R * r) // G + 1):
            
            if (N - R * r - G * g) % B == 0:
                cnt += 1
                
    
    print(cnt)
main()

Solution (Python):
a,b,c,d=map(int,input().split())
ans=0
for x in range(d//a+1):
    for y in range(d//b+1):

        if (d-(x*a+y*b))%c==0 and (d-(x*a+y*b))>=0:
            ans+=1
print(ans)

Solution (Python):
R, G, B, N = map(int, input().split())
 
ans = 0
for i in range(N//R + 1):
    for j in range(N//G + 1):
        if i*R + j*G > N:
            break
        if i*R + j*G <= N and (N - (i*R + j*G)) % B == 0:
            ans += 1
print(ans)

Solution (Python):
r,g,b,n = map(int,input().split())
a = [0 for i in range(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[n])

Solution (Python):
r,g,b,n = 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[n])

Solution (Python):
r,g,b,n = 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[n])

Solution (Python):
r,g,b,n=map(int,input().split())
dp=[0]*(n+1)
dp[0]=1
for x in [r,g,b]:
    for i in range(n+1):
        if i+x<=n:dp[i+x]+=dp[i]
print(dp[n])

Solution (Python):
R,G,B,N=map(int,input().split())
 
res = 0
for i in range(0, N//R + 1):
    for j in range(0, (N-i*R)//G + 1):
        if (N-i*R-j*G)%B == 0:
            res+=1
 
print(res)

Solution (Python):
R, G, B, N = map(int, input().split())
i = 0
for r in range(N // R + 1):
    Rr = r * R
    for g in range(N // G + 1):
        Gg = g * G
        Bb = N-Rr-Gg
        if Bb < 0:
            break
        if Bb % B == 0:
            i += 1
print(i)

Solution (Python):
def solve():
    R, G, B, N = [int(_) for _ in raw_input().split()]
    X = min(R, G, B)
    if X == R:
        Y = min(G,B)
        Z = max(G,B)
    elif X == G:
        Y = min(R,B)
        Z = max(R,B)
    else:
        Y = min(R,G)
        Z = max(R,G)
    ret = 0
    for i in range(N/Z, -1, -1):
        for j in range((N - i * Z)/Y, -1, -1):
            sum2 = N - i * Z - j * Y
            if sum2 % X == 0:
                ret += 1
    print str(ret)

if __name__ == '__main__':
    solve()

Solution (Python):
r, g, b, n = map(int, input().split())
r, g, b = sorted([r, g, b], reverse=True)
cnt = 0
for i in range(n//r+1):
    for j in range(n//g+1):
        rg = r*i + g*j
        k = (n-rg)//b
        if k >= 0 and i+j+k >= 1 and rg+b*k == n:
            cnt += 1
print(cnt)

Solution (Python):
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return list(input())
r,g,b,n=IL()
ans=0
for i in range(0,n+1):
    for j in range(0,n+1):
        if (n-i*r-j*g)%b==0 and n-i*r-j*g>=0:
            ans+=1
            
print(ans)

Solution (Python):
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return list(input())
r,g,b,n=IL()
L=[r,g,b]
L.sort()
s,m,l=L
ans=0
for i in range(n//l+1):
    for j in range(n//m+1):
        if n-i*l-j*m<0:
            break
        elif (n-i*l-j*m)%s==0:
            ans+=1
            
print(ans)

Solution (Python):
n = list(map(int, input().split()))

rmax = int(n[3] / n[0])
ans = 0
k = n[3] % n[2]

for i in range(0, rmax+1):
  sum = i * n[0]
  while sum <= n[3]:
    if sum % n[2] == k:
      ans += 1
    sum += n[1]

print(ans)

Solution (Python):
R, G, B, N = map(int, input().split())
r, g, b = 0, 0, 0
ans = 0
 
for r in range(N//R+1):
    Rr = R*r
    for g in range(N//G+1):
        Gg = G*g
        Bb = N-Rr-Gg

        if Bb < 0:
            break
        if Bb%B == 0:
            ans += 1
 
print(ans)

Solution (Python):
r,g,b,n = 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)

Solution (Python):


import numpy as np


def main():
    r, g, b, n = map(int, input().split())

    R = np.arange(0, n + 1, r)
    G = np.arange(0, n + 1, g)

    RG = np.add.outer(R, G).flatten()

    RG = RG[RG <= n]
    RG = RG[(n - RG) % b == 0]
    print(len(RG))


if __name__ == '__main__':
    main()

Solution (Python):
from collections import defaultdict, deque, Counter
def inpl(): return list(map(int, input().split()))

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

Solution (Python):


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

ans = 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:
            ans += 1
print(ans)

Solution (Python):
r, g, b, n = map(int, input().split())

count = 0
r, g, b = sorted([r, g, b], reverse=True)


for i in range(n // r + 1):
    rc = r * i
    for j in range((n - rc) // g + 1):
        gc = g * j
        if (n - rc - gc) % b == 0:
            count += 1
print(count)

Solution (Python):

R, G, B, N = [int(x) for x in input().split()]
RGB = [R, G, B]

cnt = 0
for i in range(N//R+1):
    g_range = (N - RGB[0]*i)//RGB[1]
    for j in range((N-R*i)//G+1):
        rem = N - R*i - G*j
        if rem % B == 0: 
            cnt += 1
print(cnt)

Solution (Python):

import itertools

R, G, B, N = [int(x) for x in input().split()]
RGB = [R, G, B]

cnt = 0
for i in range(N//R+1):
    g_range = (N - RGB[0]*i)//RGB[1]
    for j in range((N-R*i)//G+1):
        if R*i + G*j > N:
            continue
        rem = N - R*i - G*j
        if rem % B == 0: 
            cnt += 1
print(cnt)

Solution (Python):
R, G, B, N = map(int, input().split())

C = sorted([R, G, B], reverse=True)

print(sum((1 for c1 in range(0, N+1, C[0]) for c12 in range(c1, N+1, C[1]) if (N - c12) % C[2] == 0 )))

Solution (Python):
r, g, b, n = 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)

Solution (Python):
def solve():
    R,G,B,N = map(int,input().split())
    ans = 0
    for r in range(N // R + 1):
        for g in range(N // G + 1):
            rest = N - r * R - g * G
            if rest >=0 and rest % B == 0:
                ans += 1
                
    return ans

print(solve())

Solution (Python):
r,g,b,N=map(int,input().split())
num=0
for i in range(N+1):
  for j in range (N+1):
    s=(N-i*r-j*g)
    if s>=0 and s%b==0:
      num+=1
print(num)

Solution (Python):

import sys
sys.setrecursionlimit(10**5)
import heapq
import re
import bisect
import random
import math
import itertools
from collections import defaultdict, deque
from copy import deepcopy
from decimal import *

R, G, B, N = map(int, input().split())
count = 0
for i in range(N + 1):
    for j in range(N + 1):
        t = N - (i * R + G * j)
        if t < 0:
            break
        if t % B == 0:
            count += 1
print(count)

Solution (Python):
r,g,b,n = (int(i) for i in input().split())
ans = 0
for i in range(n//r+1):
    for j in range((n-(i*r))//g+1):
        k = (n-r*i-j*g)//b
        if r*i+j*g+abs(k*b) == n:
            ans += 1
print(ans)

Solution (Python):
R, G, B, N = 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)

Solution (Python):
r, g, b, n = map(int, input().split())

ans = 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:
            ans += 1
print(ans)

Solution (Python):
R, G, B, N = map(int, input().split())

box = sorted([R,G,B],reverse=True)

count = 0
for x in range(0,N+1,box[0]):
    for y in range(0,N+1 - x ,box[1]):
        z = (N - x - y) / box[2]
        if z >= 0 and z.is_integer():
            count += 1
print(count)

Solution (Python):
R, G, B, N = [int(n) for n in input().split()]

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

print(count)

Solution (Python):
R, G, B ,N = map(int, input().split())

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

Solution (Python):
r,g,b,n = map(int,input().split())
count = 0
rr = n // r
for i in range(rr+1):
  for j in range((n-i*r)//g+1):
    tmp = n - (i*r + j*g)
    if tmp >= 0 and tmp %  b == 0:
        count += 1
print(count)

Solution (Python):
R, G, B, N = [int(n) for n in input().split()]

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

print(count)

Solution (Python):
R,G,B,N = map(int,input().split())

count = 0
for r in range(0,N+1,R):
    for g in range(r,N+1,G):
        b = (N-g)/B
        if b.is_integer() and b >= 0:
            count += 1

print(count)

Solution (Python):
r,g,b,n = map(int,input().split())
R = n//r+1
G = n//g+1
cnt = 0
for i in range(R+1):
    for j in range(G+1):
        t = n-i*r-j*g
        if t%b==0 and t>=0:
            cnt += 1
print(cnt)

Solution (Python):
R,G,B,N=[int(c) for c in input().split()]

C=sorted([R,G,B])


"""
if(C==[1,1,1]):
	print((N+2)*(N+1)//2)
	exit()
"""





count=0
for i in range(N//C[2]+1):
	for j in range(N//C[1]+1):
		if(N-C[2]*i-C[1]*j>=0 and (N-C[2]*i-C[1]*j)%C[0]==0):
			count+=1
print(count)

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

cnt = 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:
            cnt += 1

print(cnt)

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

cnt = 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:
            cnt += 1

print(cnt)

Solution (Python):
r,g,b,n=map(int,input().split());print(sum((n-j)%b<1for i in range(0,n+1,r)for j in range(i,n+1,g)))

Solution (Python):
r, g, b, n = (int(i) for i in input().split())  
 
rmax = int(n/r)
count = 0
 
for i in range(0, rmax + 1):
  gmax = (n - r * i) // g
  for j in range(0, gmax + 1):
    tmp = n - r * i - g * j
    if (tmp % b == 0 and tmp >=0):
      count += 1
  
print(count)

Solution (Python):
r,g,b,n=map(int,input().split())
nr=n//r
ans=0
for i in range(nr+1):
  ng=(n-i*r)//g
  for j in range(ng+1):
    res=n-r*i-g*j
    if res%b==0:
      ans+=1
print(ans)

Solution (Python):


import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

R,G,B,N=MAP()

cnt=0
for x in range(3001):
    for y in range(3001):
        z=(N-R*x-G*y)/B
        
        if z>=0 and z.is_integer():
            cnt+=1
print(cnt)

Solution (Python):
R, G, B, N = map(int,input().split())

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

Solution (Python):
R, G, B, N = map(int,input().split())

cnt = 0
for i in range(0, N+1, R):
  for j in range(0, N+1, G):
    k = N - i - j
    if k >= 0:
      if k%B == 0:
        cnt += 1
    else:
      break
print(cnt)

Solution (Python):
def main():
    r,g,b,n = map(int, input().split())
    tmp = [r,g,b]
    r,g,b = sorted(tmp, reverse=True)
    res = 0
    for i in range(n//r + 1):
        if i*r > n:
            break
        for j in range(n//g + 1):
            if r*i + g*j > n:
                break
            if (n-(r*i + g*j)) % b==0:
                res += 1           
    print(res)

if __name__ == '__main__':
    main()

Solution (Python):
R, G, B, N = map(int, input().split())
ans = 0
for x in range(N // R + 1):
	for y in range(N // G + 1):
		if (N - R * x - G * y) % B == 0 and 0 <= (N - R * x - G * y) // B <= N // B:
			ans += 1
print(ans)

Solution (Python):
                                    
r,g,b,n= (int(i) for i in input().split())       

s = 0
for i in range(n//r+1):
    for k in range((n-r*i)//g+1):
        left = n-(r*i+k*g)
        if left%b == 0 and left>=0:s+=1
print(s)

Solution (Python):
r, g, b, n = map(int, input().split())
ans = 0
for i in range(n+1):
  for j in range(n+1):
    sum = r*i + g*j
    tmp = n - sum
    if tmp >= 0 and tmp%b == 0:
      ans += 1
print(ans)

Solution (Python):
R, G, B, N = 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)

Solution (Python):
r,g,b,n=map(int,input().split())
res=0
for i in range(3001):
  for j in range(3001):
    if n-r*i-g*j>=0:
      if (n-r*i-g*j)%b==0:
        res+=1
print(res)

Solution (Python):
a,b,c,n=map(int,input().split())
ans=0
for x in range(0,n+1,a):
  for y in range(x,n+1,b):
    if (n-y)%c==0:
      ans+=1
print(ans)

Solution (Python):
R, G, B, n = map(int, input().split())
ans = 0
for r in range(n // R + 1):
    Rr = R * r
    for g in range((n - Rr) // G + 1):
        tmp = Rr + G * g
        if (n - tmp) % B == 0:
            ans += 1
print(ans)

Solution (Python):
r,b,g,n=map(int,input().split())
cnt=0
if r==1 and b==1:
  for i in range(n//g+1):
    cnt+=n+1-g*i
else:
  for i in range(n//r+1):
    for j in range(n//b+1):
      if r*i+b*j==n:
        cnt+=1
      elif (n-r*i-b*j)%g==0 and (n-r*i-b*j)//g>=1:
        cnt+=1
print(cnt)

Solution (Python):
r,g,b,n=map(int,input().split());print(sum((n-i-j)%b<1for i in range(0,n+1,r)for j in range(0,n+1,g)if n>=i+j))

Solution (Python):
r,g,b,n=map(int,input().split());print(sum((n-i-j)%b<1for i in range(0,n+1,r)for j in range(0,n+1,g)if n>=i+j))

Solution (Python):
R, G, B, N = map(int, input().split())
count = 0
for r in range(0, N+1, R):
  for g in range(0, N+1-r, G):
    val = (N - r - g)
    if val % B == 0 and val >= 0:
      count += 1
print(count)

Solution (Python):
R, G, B, N = map(int, input().split())

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

print(ok)

Solution (Python):
a,b,c,n=map(int,input().split())
ans=0
for x in range((n+a)//a):
  for y in range((n+b-a*x)//b):
    z=n-a*x-b*y
    if z>=0 and z%c==0:
      ans+=1
print(ans)

Solution (Python):
r, g, b, n = map(int, input().split())
ans = 0
for i in range(n // r + 1):
    t = n - i * r
    for j in range(t // g + 1):
        if (t - j * g) % b == 0:
            ans += 1
print(ans)

Solution (Python):
a, b, c, d = (int(_) for _ in input().split())  

res = 0
for i in range(0,d+1,a):
    for ii in range(0,d-i+1,b):
        if (d - i - ii) % c == 0:
            res += 1

print(res)

Solution (Python):
R, G, B, N = map(int, input().split())
count = 0
for r in range(0, N+1, R):
  for g in range(0, N+1-r, G):
    val = (N - r - g)
    if val % B == 0 and val >= 0:
      count += 1
print(count)

Solution (Python):
a,b,c,n=map(int,input().split())
ans=0
for x in range(3001):
  for y in range(3001-a*x):
    z=n-a*x-b*y
    if z>=0 and z%c==0:
      ans+=1
print(ans)

Solution (Python):
r,g,b,n = map(int,input().split(" "))

c = 0

for i in range(n//r + 1):

	n1 = n-r*i


	for j in range(n1//g + 1):

		n2 = n1 - g * j


		if(n2%b == 0):
			c += 1


print(c)

Solution (Python):
R, G, B, N = map(int, input().split())
cnt = 0
 
for r in range(N//R + 1):
    ball1 = N - R * r
    if ball1 >= 0:
        for g in range(N//G + 1):
            ball2 = ball1 - G * g
            if ball2 >= 0:
                if ball2 % B == 0:
                    cnt += 1
 
print(cnt)

Solution (Python):
R, G, B, N = 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)

Solution (Python):

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


print(len(rgb))

Solution (Python):
R,G,B,N = map(int,input().split())
ans = 0
for x in range(N+1):
    for y in range(N+1):
        tmp = N-R*x-G*y
        if tmp >= 0 and tmp % B == 0:
            ans += 1
print(ans)

Solution (Python):
R, G, B, N = [int(s) for s in 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)