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?
r,g,b,n = map(int,input().split())
ls = [r,g,b]
z = ls[0]
y = ls[1]
x = ls[2]
ls.sort()
p = n
q = 0
X = n//x +1
Y = n//y +1
Z = n//z +1
for i in range(X):
    p = n
    for j in range(Y):
        p = n -i*x
        if p >= j*y:
            continue
        else:
            break
        for k in range(Z):
            p = n -i*x -j*y
            if p == k*z:
                q += 1
print(q)
r,g,b,n = map(int,input().split())
ans = 0
cnt = 0
for i in range(n//r+1):
    ans = 0
    for j in range((n-i*r)//g+1):
        ans = i*r+j*g
        a = (n-ans)/b
        if a % 1 == 0:
            cnt +=1
print(cnt)