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

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

print(ans)

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

ans = 0
a = N // R
for r in range(a + 1):
    m = N - r * R
    b = m // G
    for g in range(b + 1):
        k = m - g * G
        if k % 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):



import sys
from collections import deque, Counter
import bisect
import math
from itertools import accumulate, product, permutations, combinations, groupby
from fractions import gcd 
import heapq
sys.setrecursionlimit(10**6)


R,G,B,n = [int(i) for i in input().split()]

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

print(ans)

Solution (Python):
def main():
    from sys import stdin, stdout

    def read():
        return stdin.readline().rstrip('\n')

    def read_array(sep=None, maxsplit=-1):
        return read().split(sep, maxsplit)

    def read_int():
        return int(read())

    def read_int_array(sep=None, maxsplit=-1):
        return [int(a) for a in read_array(sep, maxsplit)]

    def write(*args, **kwargs):
        sep = kwargs.get('sep', ' ')
        end = kwargs.get('end', '\n')
        stdout.write(sep.join(str(a) for a in args) + end)

    def write_array(array, **kwargs):
        sep = kwargs.get('sep', ' ')
        end = kwargs.get('end', '\n')
        stdout.write(sep.join(str(a) for a in array) + end)

    r, g, b, n = read_int_array()
    dp = [0]*(n+1)
    dp[0] = 1
    for c in [r, g, b]:
        for i in range(c, n+1):
            dp[i] += dp[i-c]
    write(dp[-1])

main()

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

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

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

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

ans = 0
for i in range(0,(n//R)+1):

    k = n-R*i
    for s in range((k//G)+1):
        m = k - s*G
        if m%B == 0:
            ans += 1

print(ans)

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

num = 0
ans = 0
for r in range(N+1):
    numR = R*r
    if numR > N: continue
    for g in range(N+1):
        numG = numR + G*g
        if numG > N: continue
        b = (N-numG) / B
        if int(b) == b and b >= 0:
            ans += 1

print(ans)

Solution (Python):
R,G,B,N = map(int,input().split())
ans = 0
for a in range(0,N+1,R):
    for b in range(0,N+1,G):
        if a+b > N: break
        c = N - a - b
        if c%B==0:
            ans += 1
print(ans)

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

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

Solution (Python):
a, b, c, d = map(int ,input().split())

m = max(d/a, d/b, d/c)
m = int(m+1)
ans = 0
for i in range(m):
    for j in range(m):
        if((d - (i * a + j * b)) % c == 0 and i*a+j*b<=d):
            ans+=1
print(ans)

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

"""<https://github.com/cheran-senthil/PyRival>"""
from __future__ import division, print_function

import os
import sys
from io import BytesIO, IOBase

if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip
else:
    _str = str
    str = lambda x=b"": x if type(x) is bytes else _str(x).encode()


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




BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._buffer = BytesIO()
        self._fd = file.fileno()
        self._writable = "x" in file.mode or "r" not in file.mode
        self.write = self._buffer.write if self._writable else None

    def read(self):
        if self._buffer.tell():
            return self._buffer.read()
        return os.read(self._fd, os.fstat(self._fd).st_size)

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self._buffer.tell()
            self._buffer.seek(0, 2), self._buffer.write(b), self._buffer.seek(ptr)
        self.newlines -= 1
        return self._buffer.readline()

    def flush(self):
        if self._writable:
            os.write(self._fd, self._buffer.getvalue())
            self._buffer.truncate(0), self._buffer.seek(0)


def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", b" "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", b"\n"))
    if kwargs.pop("flush", False):
        file.flush()


sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
input = lambda: sys.stdin.readline().rstrip(b"\r\n")



if __name__ == "__main__":
    main()

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

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

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

Solution (Python):
def makelist(n, m):
    return [[0 for _ in range(m)] for _ in range(n)]


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

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

for r in range(3001):
    if r>N//R:
        break
    for g in range(3001):
        if g>N//G:
            break

        rest=N-(r*R+g*G)
        if rest>=0 and rest%B==0:
            ANS+=1

print(ANS)

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

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

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

print(res)

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

sys.setrecursionlimit(10 ** 7)

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x) - 1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

r,g,b,n = li()
ans = 0
for ri in range(0, n+1, r):
    for gi in range(0, n+1, g):
        if ri+gi > n:
            continue
        elif (n-ri-gi) % b:
            continue

        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):
import sys
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()

def main():
    R, G, B, N = LI()
    ans = 0
    for r in range(0, N+1, R):
        for g in range(0, N+1 - r, G):
            if (N - r - g) % B == 0:
                ans += 1
    return ans

print(main())