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())
cnt = 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//b>=0:
            cnt += 1
print(cnt)

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):
		if (n - (i * r + j * g)) % b == 0:
			ans += 1

print(ans)

Solution (Python):
import sys
r, g, b, n = [int(i) for i in sys.stdin.readline().split()]
memo_ls = [[0 for j in range(n+1)] for i in range(4)]
memo_ls[0][0] = 1
for i, color in enumerate(sorted([r, g, b]), 1):
    for j in range(n + 1):
        if j >= color:
            memo_ls[i][j] = memo_ls[i-1][j] + memo_ls[i][j-color]
        else:
            memo_ls[i][j] = memo_ls[i-1][j]
print(memo_ls[-1][-1])

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

Solution (Python):
r, g, b, n = map(int, input().split())
ans = [0 for i in range(n+1)]
ans[0] = 1
for i in [r,g,b]:
    for j in range(n+1-i):
        ans[j+i] += ans[j]

print(ans[n])

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):
        ij = i*r+j*g
        if n<ij:
            break
        if (n-ij)%b==0:
            cnt += 1
print(cnt)

Solution (Python):
R, G, B, N = map(int, input().split())
d = {i:0 for i in range(N+1)}

for i in range((N//G)+1):
    for j in range((N//B)+1):
        if i*G+j*B<=N:
            d[i*G+j*B] += 1

ans = 0
for i in range((N//R)+1):
    ans += d[N-(R*i)]
print(ans)

Solution (Python):
from collections import defaultdict

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

for i in range((N//G)+1):
    for j in range((N//B)+1):
        d[i*G+j*B] += 1

ans = 0
for i in range((N//R)+1):
    ans += d[N-(R*i)]
print(ans)

Solution (Python):
R, G, B, N = map(int, input().split())
ans = 0
for r in range(0, N + 1, R):
    if r > N :
        break
    for g in range(r, N + 1, G) :
        if g > N :
            break
        b = (N - g) / B
        if b >= 0 and b.is_integer() :
            ans += 1
print(ans)

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

ans=0
for r in range(0,N+1,R):
  for g in range(0,N+1,G):
    if r+g>N: break
    b=N-r-g
    if b%B==0:
      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//G+1):
    if R*r+G*g>N: continue
    if (N-R*r-G*g)%B!=0: continue
    ans+=1
print(ans)

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

x=n//r
y=n//g
ans=0
for i in range(x+1):
    for j in range(y+1):
        v=n-r*i-g*j
        if v<0:
            continue
        else:
            if v%b==0:
                ans+=1
print(ans)

Solution (Python):
r, g, b, n = (int(x) for x in input().split())
a = 0
i_r = n // r + 1
for i in range(i_r):
    rem = n - i * r
    i_g = rem // g + 1
    for j in range(i_g):
        remain = rem - j * g
        if remain >= 0 and remain % b == 0: a += 1
print(a)

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

Solution (Python):
def main():
    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)

if __name__ == "__main__":
    main()

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

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

Solution (Python):
z=input().strip().split()
R=int(z[0])
B=int(z[1])
G=int(z[2])
N=int(z[3])
count=0
n=N
while n>=0:
  copy=n
  while n>=0:
    if n%G==0:
      count+=1
    n-=B
  n=copy-R
print(count)

Solution (Python):
A=[0]*3
A[0],A[1],A[2],N=map(int,input().split())
A.sort()
ret=0
for i in range(N//A[2]+1):
  n=N-A[2]*i
  for j in range(n//A[1]+1):
    if (n-j*A[1])%A[0]==0:
      ret+=1
print(ret)

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):
        b = N - R*i - G*j
        if(b < 0):
            break
        if(b%B == 0):
            cnt += 1
print(cnt)

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

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

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

Solution (Python):

def pin(type=int):
    return map(type,input().split())

"""
O(N^2)
"""


*c,N=pin()

ans=0


I=(N//c[0])+1
J=N//c[1]+1
for i in range(I):
    for j in range(J):
        remain=(N-i*c[0]-j*c[1])
      
        if remain>=0 and remain%c[2]==0:
            
            ans+=1
            
print(ans)

Solution (Python):

def pin(type=int):
    return map(type,input().split())

"""
O(N^2)
"""


*c,N=pin()
c.sort(reverse=True)
ans=0


I=(N//c[0])+1
J=N//c[1]+1
for i in range(I):
    for j in range(J):
        remain=(N-i*c[0]-j*c[1])
      
        if remain>=0 and remain%c[2]==0:
            
            ans+=1
            
print(ans)

Solution (Python):
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 and N-(R*r+G*g) >= 0:
            count += 1
print(count)

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

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

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):
        b = (N - (R*r+G*g)) / B
        if b == int(b):
            ans += 1
print(ans)

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

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

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

Solution (Python):
r, g, b, n = map(int, input().split())
a1, a2, a3 = sorted([r, g, b])

r = 0
I = n//a3+1
for i in range(I):
    for j in range((n-i)//a2+1):
        t = n-i*a3-j*a2
        if t>=0 and t%a1==0:
            r += 1
print(r)

Solution (Python):
r,g,b,n = [int(i) for i in input().split()]
ans = 0
 
for i in range(0,n+1,r):
    for j in range(0,n+1,g):
        total = i + j
        if n - total < 0:
            break
        elif (n - total) % b == 0:
            ans += 1
 
print(ans)

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

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

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

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

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

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

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

li = [R,G,B]
li.sort()
R = li[0]
G = li[1]
B = li[2]


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

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

li = [R,G,B]
li.sort(reverse=True)
R = li[0]
G = li[1]
B = li[2]


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

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

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

    print(ct)

if __name__ == "__main__":
    main()

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

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):
        b = (n-r*R-g*G)//B
        if r * R + g * G + b * B == n:
            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):
        if ((n - (r*(i) + g*(j))) >= 0) and ((n - (r*(i) + g*(j))) % b == 0):
            cnt += 1
            
            
print(cnt)

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):
    b = (n-r*R-g*G)//B
    if r * R + g*G + b*B == n:
      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):
        b = (N - R * r - G * g) / B
        if b == int(b) and b >= 0:
            ans += 1
print(ans)

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):
    d = n - r*i - g*j
    if d%b == 0 and d >= 0:
      count += 1
print(count)

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

Solution (Python):






from sys import stdin,setrecursionlimit










setrecursionlimit(10**6)
input=stdin.readline

def main():
    r,g,b,n=map(int,input().split())
    ans=0
    for i in range(n+1):
        for j in range(n+1-i):
            now=(n-i*r-j*g)//b
            if now>=0 and (n-i*r-j*g)%b==0:
                ans+=1
    print(ans)

if __name__=="__main__":
    main()

Solution (Python):



R,G,B,N = map(int, input().split())
count = 0
for i in range(0, N + 1, R):
    K = N - i

    for j in range(0, K + 1, G):
        J = K - j

        if J % 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):
        bc=n-(r*i+g*j)
        if bc%b==0 and bc>=0:
            cnt+=1
print(cnt)

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

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

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

Solution (Python):
import collections
import itertools
r,g,b,n=map(int,input().split())
x,y=n//r,n//g
x,y=list(range(0,r*x+1,r)),list(range(0,g*y+1,g))
l=[i+j for i,j in itertools.product(x,y) if i+j<=n]
z=collections.Counter(l)
count=0
for key,value in zip(z.keys(),z.values()):
  v=n-key
  if v==0:
    count+=value
  elif v%b==0:
    count+=value
print(count)

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

print(ans)

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

ans = 0
C = sorted([r, g, b], reverse=True)
r, g, b = C[0], C[1], C[2]

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

print(ans)

Solution (Python):

import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

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

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

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):
  num=n-R*r-G*g
  if num>=0 and num%b==0:
   cnt+=1
print(cnt)

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):
  num=n-R*r-G*g
  if num>=0 and num%b==0:
   cnt+=1
print(cnt)

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

    print(ans)

if __name__ == '__main__':
    main()

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

Solution (Python):
from sys import stdin

def main():
    point = 0
    r,g,b,n = [int(x) for x in stdin.readline().rstrip().split()]
    for i in range(n//r+1):
        for j in range((n-r*i)//g+1):
            if n-r*i-g*j >= 0:
                if (n-r*i-g*j)%b == 0:
                    point += 1
    print(point)

if __name__ == "__main__":
    main()

Solution (Python):
from sys import stdin

def main():
    point = 0
    r,g,b,n = [int(x) for x in stdin.readline().rstrip().split()]
    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:
                    point += 1
    print(point)

main()

Solution (Python):
from sys import stdin
import math

point = 0

r,g,b,n = [int(x) for x in stdin.readline().rstrip().split()]
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:
                point += 1

print(point)

Solution (Python):
import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
sys.setrecursionlimit(10**9)
def gcd(a,b):return fractions.gcd(a,b) 
def lcm(a,b):return (a*b) // fractions.gcd(a,b) 
def iin(): return int(input()) 
def isn(): return input().split() 
def imn(): return map(int, input().split()) 
def iln(): return list(map(int, input().split())) 
def iln_s(): return sorted(iln()) 
def iln_r(): return sorted(iln(), reverse=True) 
def join(l, s=''): return s.join(l) 
def perm(l, n): return itertools.permutations(l, n) 
def perm_count(n, r): return math.factorial(n) // math.factorial(n-r) 
def comb(l, n): return itertools.combinations(l, n) 
def comb_count(n, r): return math.factorial(n) // (math.factorial(n-r) * math.factorial(r)) 
def divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i: divisors.append(n//i)
    return divisors
def is_prime(n):
    if n == 1: return False
    for i in range(2, int(n**0.5) + 1):
        if n % i == 0: return False 
    return True
def primes(n):
    is_prime = [True] * (n+1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5)+1):
        if not is_prime[i]: continue
        for j in range(i * 2, n + 1, i): is_prime[j] = False
    return [i for i in range(n+1) if is_prime[i]]
def sieve_of_e(n):
    is_prime = [True] * (n+1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5)+1):
        if not is_prime[i]: continue
        for j in range(i * 2, n+1, i): is_prime[j] = False
    return is_prime
def run_length_encode(s):
    count = 1
    code = []
    target = s[0]
    for i in range(1, len(s)):
        if target == s[i]: count += 1
        else:
            code.append((target, count))
            target = s[i]
            count = 1
    code.append((target, count))
    return code

R,G,B,N = imn()

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

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

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

solve()

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

solve()

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

solve()

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


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


if __name__ == '__main__':
    main()

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

count = 0
ans = 0
for r in range(0, N+1, R):
    for g in range(0, N+1-r, G):
        rg = r + g
        if rg == N or (N - rg) % B == 0:
            ans += 1
            count = 0

print(ans)

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

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

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

solve()

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 r*i + g*j > n:
            break
        if (n - r*i - g*j) == 0 or ((n - r*i - g*j) >= b and (n - r*i - g*j) % b == 0):
            ans += 1
print(ans)

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

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

if __name__ == "__main__":
    main()

Solution (Python):

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

    cnt = 0
    for i in range(int(n//r)+1):
        r_num = r * i
        for j in range(int((n - r_num)//g)+1):
            g_num = g * j
            b_num = (n - r_num - g_num)
            if b_num >= 0 and b_num % b == 0:
                cnt += 1

    print(cnt)


if __name__ == "__main__":
    main()

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

cnt = 0
for i in range(int(n//r)+1):
    r_num = r * i
    for j in range(int((n - r_num)//g)+1):
        g_num = g * j
        b_num = (n - r_num - g_num)
        if b_num >= 0 and b_num % b == 0:
            cnt += 1

print(cnt)

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

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

for i in range(3001):
  for j in range(3001):
    v = i*r + j*g
    if (n >= v and (n - v) % 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):
      rest = n  - i * r
      rest -= j * g
      if rest % 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):
        V = i * R + j * G
        if N >= V and (N - V) % 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):
    k = n - r*i -g*j
    if k >= 0 and k%b == 0:
      
      ans += 1
      
print(ans)

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

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

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

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

Solution (Python):
def main():
    R,G,B,N=map(int,input().split())
    cnt=0
    for i in range(N//R+1):
        cnt+=sum([1 for j in range((N-i*R)//G+1) if i*R + j*G +((N-i*R-j*G)//B)*B==N])
    print(cnt)

main()

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

Solution (Python):
r,g,b,n = map(int,input().split())
rgb = [r,g,b]
rgb.sort()
x = rgb[2]
y = rgb[1]
z = rgb[0]
ans = 0

for i in range(n//x+30):
    for j in range(n//y+30):
        if (n-x*i-y*j)%z ==0:
            if (n-x*i-y*j)//z >=0:
                ans += 1
          
print(ans)

Solution (Python):
def main():
  r,g,b,n=map(int,input().split())
  cnt=0
  for i in range(n//r+1):
    for j in range((n-i*r)//g+1):
      tmp=r*i+g*j
      q,mod=divmod(n-tmp,b)
      if (q>=0 and mod==0):
        cnt+=1
  print(cnt)
  
main()

Solution (Python):
def main():
  r,g,b,n=map(int,input().split())
  cnt=0
  for i in range(n//r+1):
    for j in range((n-i*r)//g+1):
      tmp=r*i+g*j
      q,mod=divmod(n-tmp,b)
      if (q>=0 and mod==0):
        cnt+=1
  print(cnt)
  
main()

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

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

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

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

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

count = 0
a = n // r
t = n // g

for i in range(a+1):
    for j in range(t+1):
        rg = i * r + j * g
        rest = n - rg
        if rest < 0:
            continue
        elif rest % b == 0:
            count += 1

print(count)

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

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 (N-R*r-G*g)%B == 0 and N-R*r-G*g >= 0:
            ans += 1
print(ans)

Solution (Python):
import sys
import numpy as np

stdin = sys.stdin
 
ri = lambda: int(rs())
rl = lambda: list(map(int, stdin.readline().split()))
rs = lambda: stdin.readline().rstrip()  

R, G, B, N = rl()
UP = 3000
A = np.zeros(UP+1, dtype=np.int32)

for r in range(UP+1):
    if r * R > UP:
        break
    A[r*R::G] += 1

answer = A[N::-B].sum()
print(answer)

Solution (Python):
import sys

stdin = sys.stdin
 
ri = lambda: int(rs())
rl = lambda: list(map(int, stdin.readline().split()))
rs = lambda: stdin.readline().rstrip()  

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

print(answer)

Solution (Python):
R, G, B, N = map(int, input().split())
ans = 0
for r in range(N + 1):
  for g in range(N + 1):
    tmp = N - R * r - G * g
    if tmp >= 0 and 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):
    rem1 = N - i * R
    for j in range(rem1 // G + 1):
        rem2 = rem1 - j * G
        if rem2 % B == 0:
            ans += 1
print(ans)

Solution (Python):

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

import math
r_lim = int(math.ceil(N / R))
for r in range(0, r_lim + 1):
    n = N - R * r

    g_lim = int(math.ceil(n / G))
    for g in range(0, g_lim + 1):
        m = n - g * G
        if m >= 0 and m % B == 0:
            ans += 1

print(ans)

Solution (Python):
R,G,B,N = map(int,input().split())
cnt = 0
for x in range(N//R+1):
    for y in range((N-x*R)//G+1):
        if (N-x*R-y*G)%B==0:
            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):
            if (N - R*i - G*j) % B == 0 and (N - R*i - G*j) > 0:
                cnt += 1
                
            if N == R*i + G*j:
                cnt += 1

print(cnt)

Solution (Python):
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()

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

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

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())

R = n // r
G = n // g

ans = 0
for i in range(R+1):
    for j in range(G+1):
        if n < i*r + j*g:
            continue
        if (n - i*r - j*g) % 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 // G + 1):
        b = (N - R*r - G*g) / B
        if b >= 0 and b.is_integer():
            count += 1

print(count)

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

if __name__=='__main__':
    main()

Solution (Python):
R, G, B, N = map(int, input().split())
ans = 0
for i in range(N//R+1):
    r = i
    for j in range(((N-R*r)//G)+1):
        g = j
        if N-R*r-G*g >= 0 and (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//G + 1):
    if R*i+G*j <= N:
      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(n+1):
    for j in range(n+1):
        if n-i*r-j*g>=0 and ((n-i*r-j*g)/b).is_integer():
            cnt+=1
print(cnt)

Solution (Python):

si = lambda: input()
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))
R,G,B,N = map(int, input().split())
ans = 0
for r in range(3001):
    for g in range(N-r+1):
        t = N-(R*r+g*G)
        if t>=0 and t%B==0:
            ans += 1
print(ans)

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

print(ans)

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

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

print(ans)

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

Solution (Python):
from sys import stdin
R, G, B, N = [int(_) for _ in stdin.readline().rstrip().split()]
ans = 0
for i in range(3001):
  for j in range(3001):
    tmp = i*R+j*G
    if N >= tmp and (N-tmp)%B == 0:
      ans += 1
print(ans)

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

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

Solution (Python):
import sys


		
def main():
	R,G,B,N = map(int, input().split())
	cc=0
	ri=0
	while ri * R <= N:
		gi=0
		while G*gi + ri*R <= N:
			nn=N-(G*gi+R*ri)
			if nn % B == 0:
				cc+=1
			gi+=1
		ri+=1
	
	print(cc)
	
	

isTest=False

def pa(v):
	if isTest:
		print(v)

if __name__ == "__main__":
	if sys.platform =='ios':
		sys.stdin=open('inputFile.txt')
		isTest=True
	else:
		pass
		
			
	ret = main()
	if ret is not None:
		print(ret)

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

for a in range(n+1):
  for c in range(n+1):
    Bb = n - r*a - g*c
    if Bb >= 0:
      if Bb % b == 0:
        count += 1
    else:
      break

print(count)