#DIVERTA2019B. RGB Boxes

RGB Boxes

Score : 200200 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 RR red balls
  • Green boxes, each containing GG green balls
  • Blue boxes, each containing BB blue balls

Snuke wants to get a total of exactly NN balls by buying rr red boxes, gg green boxes and bb blue boxes. How many triples of non-negative integers (r,g,b)(r,g,b) achieve this?

Constraints

  • All values in input are integers.
  • 1R,G,B,N30001 \leq R,G,B,N \leq 3000

Input

Input is given from Standard Input in the following format:

RR GG BB NN

Output

Print the answer.

1 2 3 4
4

Four triples achieve the objective, as follows:

  • (4,0,0)(4,0,0)
  • (2,1,0)(2,1,0)
  • (1,0,1)(1,0,1)
  • (0,2,0)(0,2,0)
13 1 4 3000
87058