#abc051b. [abc051_b]Sum of Three Integers

[abc051_b]Sum of Three Integers

Problem Statement

You are given two integers KK and SS.
Three variable X,YX, Y and ZZ takes integer values satisfying 0X,Y,ZK0≤X,Y,Z≤K.
How many different assignments of values to X,YX, Y and ZZ are there such that X+Y+Z=SX + Y + Z = S?

Constraints

  • 2K25002≤K≤2500
  • 0S3K0≤S≤3K
  • KK and SS are integers.

Input

The input is given from Standard Input in the following format:

KK SS

Output

Print the number of the triples of X,YX, Y and ZZ that satisfy the condition.


Sample Input 1

2 2

Sample Output 1

6

There are six triples of X,YX, Y and ZZ that satisfy the condition:

  • X=0,Y=0,Z=2X = 0, Y = 0, Z = 2
  • X=0,Y=2,Z=0X = 0, Y = 2, Z = 0
  • X=2,Y=0,Z=0X = 2, Y = 0, Z = 0
  • X=0,Y=1,Z=1X = 0, Y = 1, Z = 1
  • X=1,Y=0,Z=1X = 1, Y = 0, Z = 1
  • X=1,Y=1,Z=0X = 1, Y = 1, Z = 0

Sample Input 2

5 15

Sample Output 2

1

The maximum value of X+Y+ZX + Y + Z is 1515, achieved by one triple of X,YX, Y and ZZ.