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):
import bisect
import heapq
import itertools
import math
import operator
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7













R, G, B, N = list(map(int, sys.stdin.readline().split()))

ans = 0
for r in range(0, N + 1, R):
    for g in range(0, N + 1 - r, G):
        b = N - r - g
        if b == 0 or b > 0 and 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 (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())
Rm = N // R
cnt = 0
for r in range(Rm+1):
  x = N - r * R
  Gm = x // G
  for g in range(Gm+1):
    Bb = N - r * R - G * g
    if Bb % B == 0:
      cnt += 1
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 - i + 1, g):
        if (n - i - j) % b == 0:
            cnt += 1
print(cnt)

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

R = num[0]
G = num[1]
B = num[2]
N = num[3]
ans = 0

rmax = N // R

for r in range(rmax + 1):
    gmax = (N - R * r) // G 
    for g in range(gmax + 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 or (n-(r*i+g*j)) == 0:
                           ans += 1
print(ans)

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

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

Solution (Python):
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

a,b,c,n = inpl()
res = 0
for i in range(3001):
    for j in range(3001):
        tmp = n - (i*a + j*b)
        if tmp < 0:
            break
        if tmp % c == 0:
            res += 1
print(res)

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

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

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())
l=[r,g,b,n]
count=0
for i in range(n+1):
  for j in range(n+1):
    if (n-(i*r+j*g))/b==int((n-(i*r+j*g))/b) and (n-(i*r+j*g))/b>=0:
      count+=1
print(count)

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

Solution (Python):
import math
r,g,b,n=map(int, input().split()) 
count=0
k=[]
for i in range(n+1):
    for j in range(n+1):
        if n-(i*g+j*r)>=0:
            k.append(i*g+j*r)
        else:
            break
     
for i in range(len(k)):
    if (n-k[i])%b==0:
        count+=1
            
print(count)

Solution (Python):
import sys


def solve():
    input = sys.stdin.readline
    mod = 10 ** 9 + 7
    r, g, b, n = list(map(int, input().rstrip('\n').split()))
    cnt = 0
    for i in range(n+1):
        for j in range(n+1):
            if r * i + g * j > n:
                break
            else:
                if (n - r * i - g * j) % b == 0:
                    cnt += 1
    print(cnt)


if __name__ == '__main__':
    solve()

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

Solution (Python):
def main():
    a,b,c,n=map(int,input().split())
    res = 0
    l = [a,b,c]
    l.sort()
    for i in range(n // l[2]+1):
        for j in range(n//l[1]+1):
            if n < l[2]*i+l[1]*j:
                break
            if (n - l[2] * i - l[1] * j ) % l[0] == 0:
                res += 1
    print(res)

main()

Solution (Python):
def main():
    a,b,c,n=map(int,input().split())
    res = 0
    l = [a,b,c]
    l.sort()
    for i in range(n // l[2]+1):
        for j in range(n//l[1]+1):
            if n < l[2]*i+l[1]*j:
                break
            if (n - l[2] * i - l[1] * j ) % l[0] == 0:
                res += 1
    print(res)

main()

Solution (Python):
a,b,c,n=map(int,input().split())
res = 0
for i in range(n // a+1):
    for j in range(n//b+1):
        if n < a*i+b*j:
            break
        if (n - a * i - b * j ) // c > -1 and (n - a * i - b * j ) % c == 0:
            res += 1
print(res)

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

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

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

Solution (Python):
*j, N = map(int,input().split())
j.sort()
a,b,c = j
cnt = 0
for r in range(N//b+1):
    for g in range((N-b*r)//c+1):
        v = b*r+c*g
        if (N-v)%a == 0:
            cnt += 1
print(cnt)

Solution (Python):
def resolve():
    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 >= 0 and b % B == 0:
                ans += 1
    print(ans)


if __name__ == "__main__":
    resolve()

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

Solution (Python):
R, G, B, N = tuple(map(int, input().split()))
ans = 0
for i in range(N//R+1):
    for j in range(N//G+1):
        rest = (N - R * i - G * j)
        if rest < 0:
            break
        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+2):
    flag = False
    for j in range(n//g+2):
        tmp = n - (r*i + g*j)
        if tmp < 0:
            break 
        if tmp % b == 0:
            ans += 1

print(ans)

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

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())
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())
R, G, B = sorted([R, G, B], reverse=True)
if B == 1:
  c = 0
  for r in range(0, N+1):
    if r*R > N:
      break
    n = N-r*R
    c += 1+n//G
  print(c)
  exit()
c = 0
for r in range(0, N+1):
  if r*R > N:
    break
  for g in range(0, N+1):
    if r*R+g*G > N:
      break
    n = N-r*R-g*G
    if n%B == 0:
      c += 1
print(c)

Solution (Python):
b,r,g,n=map(int,input().split())
ans=0
for i in range(3000//r+1):
    for j in range(3000//g+1):
        if n-j*g-i*r>=0 and (n-j*g-i*r)%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):
        k = (n - i * r - j * g) // b
        if k < 0:
            continue
        if i * r + j * g + k * b == n:
            ans += 1
print(ans)

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

Solution (Python):
r, g, b, n = [int(num) for num in input().split()]
arr = [r, g, b]
arr.sort()


counter = 0
for c_1 in range(0, n // arr[-1] + 1):
  for c_2 in range(0, n // arr[-2] + 1):
      if n - c_1 * arr[-1] - c_2 * arr[-2] < 0:
        break
      if (n - c_1 * arr[-1] - c_2 * arr[-2]) % arr[-3] == 0:
        counter += 1
print(counter)

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(int(N / R) + 1):
    for j in range(int((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())

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

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

Solution (Python):
r, g, b, n = [ int(v) for v in input().split() ]
r, g, b = sorted([r, g, b],reverse = True)

ans = 0
for i in range((n+r)//r):
    n1 = n - r * i
    for j in range((n1+g)//g):
        n2 = n1 - g * j
        if n2 % 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-r*R)//G+1):
        b0 = N-r*R-g*G
        if b0 % B == 0:
            ans += 1

print(ans)

Solution (Python):



import sys
import math
import bisect
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7

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


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

if __name__ == "__main__":
    solve()

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

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

ans=0
for r in range(3000+1):
    if N < r*R:
        break
    for g in range(3000+1):
        if N < r*R+g*G:
            break
        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 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 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())


ir=int(N/R)+1
ig=int(N/G)+1
ib=int(N/B)+1
s=0
for r in range(ir):
    for g in range(ig):
        if(R*r+G*g>N):
            break;
        if((N-R*r-G*g)%B==0):
            s+=1
print(s)

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

print(res)

Solution (Python):
R, G, B, N = map(int, input().split())
cnt = 0
rindex = 0
while R * rindex <= N:
	gindex = 0
	while R * rindex + G * gindex <= N:
		if (N - R * rindex - G * gindex) % B == 0:
			cnt += 1
		gindex += 1
	rindex += 1
print(cnt)

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 0 <= t and t % 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):
    N1 = N - r*R
    for g in range(N1 // G + 1):
        N2 = N1 - g*G
        if N2 % B == 0: ans += 1
print(ans)

Solution (Python):
from itertools import product

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

Solution (Python):
import math
import fractions
import itertools
import copy
import collections
from operator import itemgetter

def j(q):
    if q==1: print("Yes")
    elif q == 0:print("No")
    exit(0)


"""
def ct(x,y):
    if (x>y):print("+")
    elif (x<y): print("-")
    else: print("?")
"""

def ip():
    return int(input())
def printrow(a):
    for i in range(len(a)):
        print(a[i])
def combinations(n,r):
    if n<r:return 0
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
def permutations(n,r):
    if n<r:return 0
    return math.factorial(n) // math.factorial(n - r)
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)



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

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

print(cnt)

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

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

print(ans)

Solution (Python):
R, G, B, N = map(int, input().split())
ball = 0
count = 0
num = N//R
for i in range(num+1):
    ball = N-(i*R)
    num2 = ball//G
    for j in range(num2+1):
        n2 = ball-(j*G)
        if n2%B == 0 or n2 == 0:
            count +=1
        else:
            continue
print(count)

Solution (Python):




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


'''
for i in range h:
    temp = list(map(int, input().split()))
    table.append(temp)
'''
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 = 0

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

Solution (Python):
R, G, B, N = list(map(int, input().split()))
m = 0
NN = N
for r in range(N//R + 1) :
  if r != 0 :
    NN -= R
  for g in range(NN//G + 1) :
    if g == 0 :
      NNN = NN
    else :
      NNN -= G
    if NNN%B == 0 :
      m += 1

print(m)

Solution (Python):

import sys


def solve(R: int, G: int, B: int, N: int):
    
    res = 0
    for r in range(N+1): 
        if r*R > N:
            break
        for g in range(N+1): 
            rgcnt = r*R + g*G 
            if rgcnt > N:
                break
            if (N-rgcnt) % B == 0:
                res += 1

    print(res)

    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    R = int(next(tokens))  
    G = int(next(tokens))  
    B = int(next(tokens))  
    N = int(next(tokens))  
    solve(R, G, B, N)

if __name__ == '__main__':
    main()

Solution (Python):

from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LS()
    return l
sys.setrecursionlimit(1000000)
mod = 1000000007


def A():
    n,k = LI()
    print(n-k+1)
    return


def B():
    r,g,b,n = LI()
    ans = 0
    for i in range(n+1):
        x = r*i
        for j in range(n+1-x):
            y = g*j
            z = n-x-y
            if z%b != 0 or z < 0:continue
            ans += 1
    print(ans)
    return


def C():
    n = I()

    return


def D():
    n = I()

    return


def E():
    n = I()

    return


def F():
    n = I()

    return


def G():
    n = I()

    return


def H():
    n = I()

    return


def I_():
    n = I()

    return


def J():
    n = I()

    return


if __name__ == "__main__":
    B()

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

RGB = sorted([R, G, B], reverse=True)
max1 = N // RGB[0] 

count = 0
for r in range(max1+1):
    max2 = min([N-r, (N-r*RGB[0])//RGB[1]])
    for g in range(max2+1):
        if (N - (r*RGB[0] + g*RGB[1])) % RGB[2] == 0:
            count += 1
print(count)

Solution (Python):
a,b,c,n=map(int,input().split())
d=[a,b,c]
d.sort()
a=d[0]
b=d[1]
c=d[2]
e=0
for i in range(0,n//c+1):
    for k in range(0,(n-c*i)//b+1):
        if ((n-c*i-b*k)%a)==0:
            e=e+1
print(e)

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

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

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

count = 0

r_max = N // R
for r in range(0,r_max+1):
	N_N = N - R * r
	g_max = N_N//G+1
	for g in range(0,g_max):
		if (N-r*R - g*G)%B == 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*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())
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())
 
ans = 0
for r in range(N//R+1):
  for g in range(N//G+1):
    tmp = r*R+g*G
    if  tmp <= N and (N-tmp) % B == 0:
      ans += 1
print(ans)

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

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

count = 0
while N >= 0 :
    N_2 = N
    while N_2 >= 0:
        if N_2 % B == 0:
            count += 1
        N_2 -= G
    N -= R

print(count)

Solution (Python):
a,b,c,n = tuple(int(x) for x in raw_input().split(' '))

ans = 0
for i in xrange(0, n/a+1):
  for j in xrange(0, n/b+1):
    k = (n - i*a - j*b)/c
    
    if i*a+j*b+k*c == n and k >= 0:
      ans += 1
print ans

Solution (Python):
R,G,B,N=map(int,input().split())
a=[0]*(N+1)
a[0]=1

for i in [R,G,B]:
    for j in range(N+1-i):
        a[j+i]+=a[j]
 
print(a[N])

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

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

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

Solution (Python):
r,g,b,n = map(int,input().split())
count = 0
lis = [r,g,b]
lis.sort()
r = lis[0]
g = lis[1]
b = lis[2]
for i in range((n//b)+1):
    cn = n - b*i
    for j in range((cn//g)+1):
        cn2 = cn - g*j
        if cn2%r == 0:
            count += 1
print(count)

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

Solution (Python):
r, g, b, n = [int(i) for i in input().split()]
total = 0
rm = n//r
for rn in range(rm + 1):
	gm = (n - rn * r) // g
	for gn in range(gm + 1):
		bd = n - r * rn - g * gn
		if bd % b == 0:
			total += 1
print(total)

Solution (Python):
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b



def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)



def lcm(a, b):
    g = gcd(a, b)
    return a / g * b


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

    ans = 0
    for r in range(N // R + 10):
        for g in range(N // G + 10):
            rest = N - R * r - G * g
            if rest < 0 or rest % B != 0:
                continue
            ans += 1
    
    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):

import sys
input = sys.stdin.readline
def mi(): return map(int, input().split())


Rt, Gt, Bt, N = mi()

R = max(Rt, Gt, Bt)
B = min(Rt, Gt, Bt)
G = Rt+Gt+Bt-R-B

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)

Solution (Python):

import sys
input = sys.stdin.readline
def mi(): return map(int, input().split())


Rt, Gt, Bt, N = mi()

R = max(Rt, Gt, Bt)
B = min(Rt, Gt, Bt)
G = Rt+Gt+Bt-R-B

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

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)

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

Solution (Python):
import sys,random
try: sys.stdin = open('in.in','r')
except: pass

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

ans = 0
for r in range(0,N+1,R):
	for b in range(0,N+1-r,B):
		if (N-b-r)%G != 0: continue
		ans += 1
print(ans)

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

ret = 0

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

print(ret)

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):
import numpy as np

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

x = np.arange(3001)
t = np.array([np.arange(0,3001*g,g)]*3001).T
y = np.array([x]*3001)
z = y*r+t
print(np.sum(np.logical_and((n-z)%b==0,n-z>=0)))

Solution (Python):
import numpy as np

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

x = np.arange(3001)
rr=x*r
f=0
for i in range(3002):
    p = ((n-rr)%b==0)
    q = n-rr>=0
    f+=np.sum(np.logical_and(p,q))
    rr+=g
print(f)

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

print(ans)

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

"""
B - RGB Boxes
https://atcoder.jp/contests/diverta2019/tasks/diverta2019_b

"""
import sys


def solve(R, G, B, N):
    ans = 0
    for r in range(N//R+1):
        for g in range(N//G+1):
            t = N - r*R - g*G
            if t < 0:
                break
            if t % B == 0:
                ans += 1
    return ans


def main(args):
    R, G, B, N = map(int, input().split())
    ans = solve(R, G, B, N)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])

Solution (Python):

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

Solution (Python):


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

cnt = 0

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

print(cnt)

Solution (Python):
import numpy as np
I=lambda:map(int,input().split())
R,G,B,N=I()
bB=N-np.arange(0,N+1,R)-np.arange(0,N+1,G).reshape(-1,1)
print(np.sum((bB>=0)&(bB%B==0)))

Solution (Python):
r, b, g, n = [int(x) for x in input().rstrip().split(" ")]

total = 0

for current_1 in range(0, n + 1, r):
  for current_2 in range(current_1, n + 1, b):
    if (n - current_2) % g == 0:
      total += 1

print(total)

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

Solution (Python):
def combinations(R, G, B, N):
    R, G, B, N = int(R), int(G), int(B), int(N)
    sorted_tuple = sorted((R, G, B), reverse=True)
    R = sorted_tuple[0]
    G = sorted_tuple[1]
    B = sorted_tuple[2]
    number_combos = 0

    for x in range(N // R + 1):
        for y in range((N - R * x) // G + 1):
            if (N - R * x - G * y) % B == 0:
                number_combos += 1
        
    return number_combos

R, G, B, N = input().split(' ')
print(combinations(R, G, B, N))

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

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

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