0.5 Nobita solves a Problem
(RankList for this Question)
Score: 20pts
Time Limit: 2.00 sec
Dekisugi challenges Nobita to solve a problem but Nobita asks Doraemon to write a code which will solve the problem quickly. You are Doraemon in the fictional world.
Help Nobita to find the answer.

Dekisugi gives two integers K and S.
There exist 3 variables X, Y, Z satisfying 0 <= X,Y, Z <= K
Nobita needs to find the different assignment of values to X,Y and Z such that X + Y + Z = S.

Constraints
2 ≤ K ≤ 2500
0 ≤ S ≤ 3K
K and S are Integers.

Input Format
K S

Output Format
Number of Triplets X , Y , Z that satisfies the condition.

Example 1
Input:
2 2

Output:
6

Explanation:
There are six triples of X , Y , Z that satisfy the condition:
X=0,Y=0,Z=2
X=0,Y=2,Z=0
X=2,Y=0,Z=0
X=0,Y=1,Z=1
X=1,Y=0,Z=1
X=1,Y=1,Z=0

Log In to solve the Question