{"raw_statement":[{"iden":"problem statement","content":"You are given two integers $K$ and $S$.  \nThree variable $X, Y$ and $Z$ takes integer values satisfying $0≤X,Y,Z≤K$.  \nHow many different assignments of values to $X, Y$ and $Z$ are there such that $X + Y + Z = S$?"},{"iden":"constraints","content":"*   $2≤K≤2500$\n*   $0≤S≤3K$\n*   $K$ and $S$ are integers."},{"iden":"input","content":"The input is given from Standard Input in the following format:\n\n$K$ $S$"},{"iden":"sample input 1","content":"2 2"},{"iden":"sample output 1","content":"6\n\nThere are six triples of $X, Y$ and $Z$ that satisfy the condition:\n\n*   $X = 0, Y = 0, Z = 2$\n*   $X = 0, Y = 2, Z = 0$\n*   $X = 2, Y = 0, Z = 0$\n*   $X = 0, Y = 1, Z = 1$\n*   $X = 1, Y = 0, Z = 1$\n*   $X = 1, Y = 1, Z = 0$"},{"iden":"sample input 2","content":"5 15"},{"iden":"sample output 2","content":"1\n\nThe maximum value of $X + Y + Z$ is $15$, achieved by one triple of $X, Y$ and $Z$."}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}