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

BALL = [0]*(N+100)
BALL[0] = 1

for num in range(0,N+1,1):
    if BALL[num] != 0 and num + R <= N:
        BALL[num+R] += BALL[num]
for num in range(0,N+1,1):
    if BALL[num] != 0 and num + G <= N:
        BALL[num+G] += BALL[num]

for num in range(0,N+1,1):
    if BALL[num] != 0 and num + B <= N:
        BALL[num+B] += BALL[num]

print(BALL[N])

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 8)
ni = lambda: int(sys.stdin.readline())
nm = lambda: map(int, sys.stdin.readline().split())
nl = lambda: list(nm())
ns = lambda: sys.stdin.readline().rstrip()

R, G, B, N = nm()


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


if __name__ == "__main__":
    print(solve())

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 8)
ni = lambda: int(sys.stdin.readline())
nm = lambda: map(int, sys.stdin.readline().split())
nl = lambda: list(nm())
ns = lambda: sys.stdin.readline().rstrip()

R, G, B, N = nm()


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


if __name__ == "__main__":
    print(solve())

Solution (Python):
import sys

input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)


def is_integer_num(n):
    if isinstance(n, int):
        return True
    if isinstance(n, float):
        return n.is_integer()
    return False


def main():
    R, G, B, N = map(float, input().split())
    cnt = 0

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

    print(cnt)


if __name__ == "__main__":
    main()

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

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

if __name__ == "__main__":
    main()

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

Solution (Python):
R, G, B, N = map(int, input().split())
R, G, B = sorted([R, G, B], reverse=True)
maxR = N // R
ans = 0
if R == 1:
    ans = (N+2)*(N+1) // 2
    print(ans)
    quit()

for r in range(maxR+1):
    if r * R == N:
        ans += 1
        continue
    n = N - r * R
    maxG = n // G
    for g in range(maxG+1):
        if g * G == n:
            ans += 1
            continue
        nn = n - g * G
        maxB = nn // B
        for b in range(maxB+1):
            if b * B == nn:
                ans += 1

print(ans)

Solution (Python):
def main():
    R,G,B,N=map(int,input().split())
    cnt=0
    for r in range(0,N//R+1):
        for g in range(0,(N-r*R)//G+1):
            bunshi=N-r*R-g*G
            q,m=divmod(bunshi,B)
            
            if m==0:cnt+=1
    print(cnt)
main()

Solution (Python):
R,G,B,N=map(int,input().split())
cnt=0
for r in range(0,N+1):
    for g in range(0,N+1):
        bunshi=N-r*R-g*G
        q,m=divmod(bunshi,B)
        if q<0:continue
        if m==0:cnt+=1
            
print(cnt)

Solution (Python):
R,G,B,N=map(int,input().split())
cnt=0
for r in range(0,N//R+1):
    for g in range(0,(N-r*R)//G+1):
        bunshi=N-r*R-g*G
        q,m=divmod(bunshi,B)
        if q<0:continue
        if m==0:cnt+=1   
print(cnt)

Solution (Python):
import math

r, g, b, n = map(int, input().split())
ball = [0, r, g, b]
count = 0

for i in range(n+1):
    for j in range(n+1):
        m = math.floor((n-i*r-j*g)/b)
        if i*r+j*g+m*b == n and m >= 0:
            count += 1
            
print(count)

Solution (Python):
r, g, b, n = map(int, input().split())
ball = [0, r, g, b]
dp = [[0] * 4 for _ in range(n+1)]
dp[0][0] = 1

for i in range(n+1):
    for k in range(4):
        if k == 0:
            if i != 0:
                dp[i][k] = 0
        else:
            if i - ball[k] < 0:
                dp[i][k] = dp[i][k-1]
            else:
                dp[i][k] = dp[i-ball[k]][k] + dp[i][k-1]

print(dp[n][3])

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

ans = 0
for r in range(N // R + 1):
    rest = N - r * R
    ans += sum((rest - g * G) % B == 0 for g in range (rest // G + 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())

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

print(ans)

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

Solution (Python):
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))


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

            ans += 1
print(ans)
'''


*num,n = iim()
a,b,c = map(int,sorted(num))
ans = 0
for i in range(n//c+1):
    if a!= 1:
        for j in range(n//b+1):
            num = n-i*c-j*b
            if num%a == 0 and num//a >= 0:
                ans += 1
    else:
        ret = n - i*c
        ans += ret//b+1
print(ans)

Solution (Python):
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

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

            ans += 1
print(ans)

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

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

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

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

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

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 7)
rl = sys.stdin.readline


def solve():
    R, G, B, N = map(int, rl().split())
    
    ans = 0
    for r in range(0, N + 1, R):
        for g in range(0, N + 1, G):
            if N < r + g:
                break
            if (N - r - g) % B == 0:
                ans += 1
    print(ans)


if __name__ == '__main__':
    solve()

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

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

Solution (Python):
import sys











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










def main():
    R,G,B,N = map(int, stdin.readline().rstrip().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%1==0 and b>=0:
                ans += 1
    print(ans)

main()

Solution (Python):
R, G, B, N = map(int, input().split())
"""
3000以下なので全探索を考える。
まず，全探索できるものは全探索から考える必要がある。
オーダーを計算し，いけそうならそれで行くべき。今回は固定を順にしていくので間に合う
そこから探索する範囲を絞り込んで
"""

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

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

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

print(ans)

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

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

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

Solution (Python):

"""
Created on Tue May 12 14:18:43 2020

@author: shinba
"""

def is_integer_num(n):
    if isinstance(n, int):
        return True
    if isinstance(n, float):
        return n.is_integer()
    return False

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

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

print(ans)

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

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

print(count)

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 = list(map(int, input().split()))


def main() -> None:
    """Entry point
    """
    
    """
    r, gをそれぞれ固定して探索を行う.
    """
    r_max = N // R
    g_max = N // G
    result = 0
    for r in range(r_max+1):
        n_r = r * R
        for g in range(g_max+1):
            n_rg = n_r + g * G
            
            if N < n_rg:
                continue
            
            if (N - n_rg) % B == 0:
                result += 1

    
    print(result)


if __name__ == "__main__":
    main()

Solution (Python):


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


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

    
    print(result)


if __name__ == "__main__":
    main()

Solution (Python):


import sys
input= lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(10**9)
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
def lispin(t=int):return list(pin(t))


def resolve():
    R,G,B,N=pin()
    cnt=0
    for r in range(N+1):
        for g in range(N+1):
            t=(R*r+G*g)
            if N<t:continue
            if (N-t)%B==0:
                
                cnt+=1
    print(cnt)

resolve()

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

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

Solution (Python):
red, green, blue, n = map(int, input().split())

ans = 0
for i in range(n // red + 1):
    for j in range(n // blue + 1):
        k = n - red * i - blue * j
        
        if k % green != 0 or k < 0:
            continue
        
        ans += 1

print(ans)

Solution (Python):
rgb = [0]*3
rgb[0],rgb[1],rgb[2],n = map(int,input().split())
rgb.sort()

ans=0
for i in range(n//rgb[2]+1):
    for j in range((n-i*rgb[2])//rgb[1]+1):
        d = n-i*rgb[2]-j*rgb[1]
        if d%rgb[0]==0 and d>=0:
            ans+=1

print(ans)

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

Solution (Python):
r,g,b,n = map(int,input().split())
cou  = 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:
      cou += 1
 
print(cou)

Solution (Python):
import sys
import re
import math
import collections
import decimal
import bisect
import itertools

import copy






INF = sys.maxsize
MOD = 10 ** 9 + 7

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))





def main():
    r, g, b, n = ns()
    ans = 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 % b == 0:
                ans += 1
    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
import sys
import re
import math
import collections
import decimal
import bisect
import itertools

import copy






INF = sys.maxsize
MOD = 10 ** 9 + 7

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))





def main():
    r, g, b, n = ns()
    ans = 0
    for i in range(n // r + 1):
        for j in range(n // g + 1):
            tmp = n - r * i - g * j
            if tmp % b == 0 and tmp > -1:
                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):
  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())

res = 0
for r in range(n + 1):
	for g in range(n + 1):
		b = n - r * R - g * G
		if b == 0 or (b > 0 and b % B == 0):
			res += 1
print(res)

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

dp = [0 for i in range(n+1)]
dp[0] = 1

for i in range(r, n+1, r):
    dp[i] = 1
for i in range(g, n+1):
    dp[i] += dp[i-g]
for i in range(b, n+1):
    dp[i] += dp[i-b]

print(dp[-1])

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

ans = 0

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

print(ans)

Solution (Python):


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

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

Solution (Python):

import collections
import itertools as it
import math

 


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





ans = 0
for r_ in range(n+1):
    for g_ in range(n+1):
        sum_ = n - (r_ * r + g_ * g)
        if sum_ >= 0 and sum_ % b == 0:
            ans += 1

print(ans)

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

ans = 0
for r in range(3001):
    for g in range(3001):
        tmp = (R*r+G*g)
        if tmp > N:
            break

        if (N-tmp) % B == 0 or tmp == 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())

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):
n=list(map(int,input().split()))
a= str(n[0])+str(n[1])+str(n[2])
maiden=0;z=0;iguales=4504501;iguales_2=1127251;iguales_3=2253001
if(n[0]==1 and n[1]==1 and n[2]==1):
    for k in range(3000-n[3]):
        iguales = iguales-(3001-k)
    print(iguales)
elif(n[0]==2 and n[1]==2 and n[2]==2):
    if(n[3]%2==0):
        for k in range(int((3000-n[3])/2)):
            iguales_2 = iguales_2-(1501-k)
        print(iguales_2)
    else:
        print(0)
elif(a=='121'or a=='112' or a=='211' and n[3]>=2997):
    for k in range(int(3000 -n[3])):
            iguales_3 = iguales_3-(1501-k)
    print(iguales_3)
else:
    for i in range((n[3]//n[0])+1):
        for j in range((n[3]//n[1])+1):
            z=(n[3]-i*n[0]-j*n[1])/n[2]
            if(z%1==0 and z>=0):
                maiden=maiden+1    
    print(maiden)

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

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

c = 0
for r in range(n // R + 1):
    x = n - r * R
    for g in range(x // G + 1):
        y = x - g * G
        if(y % B == 0):c += 1
print(c)

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):
        b=N-(R*i+G*j)
        if b==0 or  b%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())
ans=0

for i in range(N//R+1):
    for j in range((N-R*i)//G+1):
        b=N-(R*i+G*j)
        if b==0 or  b%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):
        b=N-(R*i+G*j)
        if b==0 or  b%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):
import sys
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7

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

if __name__ == '__main__':
    main()

Solution (Python):
SIZE = 3001
def main():
    output = 0
    R, G, B, N = (int(_) for _ in input().split())
    for r in range(SIZE):
      for g in range(SIZE):
        b = N - r * R - g * G
        if 0 <= b and b%B == 0: output += 1
    print(output)
    return

if __name__ == '__main__':
    main()

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

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

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

print(ans)

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

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

if __name__ == "__main__":
    main()

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

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

print(cnt)

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

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

print(cnt)

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

def it():
    for i in range(N//R+1):
        r = R*i
        for j in range((N-r)//G+1):
            g = G*j
            b = N - r - g
            if b % B == 0:
                yield 1

print(sum(it()))

Solution (Python):
def resolve():
    '''
    code here
    '''

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

    cnt = 0

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

    print(cnt)

if __name__ == "__main__":
    resolve()

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

print(ans)

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    R, G, B, n = map(int, input().split())

    res = 0
    for r in range(n // R + 1):
        for g in range(n // G + 1):
            b = (n - (R * r + G * g)) // B
            if R * r + G * g + B * b == n and b >= 0:
                res += 1

    print(res)


if __name__ == '__main__':
    resolve()

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

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

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

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

for r in range(N_1//R + 1):
    N_2 = N_1
    N_2 -= r*R
    for g in range(N_2//G + 1):
        N_3 = N_2
        N_3 -= g*G

        if N_3%B == 0:
            cnt += 1

print(cnt)

Solution (Python):


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

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

print(answer)

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

Solution (Python):
from math import ceil


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


if __name__ == '__main__':
    main()

Solution (Python):
import sys
stdin = sys.stdin
 
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

r,g,b,n = na()
ans=0
for i in range(n//r+1):
    a = n-r*i
    for j in range(a//g+1):
        if (a-g*j)%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):
    buy = i*r + j*g
    if n - buy < 0:
      break
    elif (n - buy)%b == 0:
      ans += 1
print(ans)

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

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

ans = 0
for r in range(mr+1):
    for g in range(mg+1):
        val = N - r*R - g*G
        if val >= 0 and val % 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 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 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

print(ans)

Solution (Python):
def myAnswer(R:int,G:int,B:int,N:int) -> int:
   ans = 0
   for i in range(0,N+1,R):
      for j in range(0,N+1,G):
         k = N - j - i
         if( k % B != 0 or k < 0):
            continue
         else:
            
            ans += 1

   return ans

def modelAnswer():
   return
def main():
   R,G,B,N = map(int,input().split())
   print(myAnswer(R,G,B,N))
if __name__ == '__main__':
   main()

Solution (Python):
def myAnswer(R:int,G:int,B:int,N:int) -> int:
   ans = 0
   for i in range(0,N+1,R):
      for j in range(0,N+1,G):
         k = N - j - i
         if( k % B != 0 or k < 0):
            continue
         else:
            
            ans += 1

   return ans

def modelAnswer():
   return
def main():
   R,G,B,N = map(int,input().split())
   print(myAnswer(R,G,B,N))
if __name__ == '__main__':
   main()

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

      
print(ans)

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

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

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

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

dic = defaultdict(int)
for i in range(n // r + 1):
    for j in range(n // g + 1):
        dic[i * r + j * g] += 1


ans = 0
for k in range(n // b + 1):
    num = n - k * b
    ans += dic.get(num, 0)
print(ans)

Solution (Python):
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil
    

    
    

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

if __name__ == '__main__':
    main()

Solution (Python):
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil
    

    
    

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

if __name__ == '__main__':
    main()