You are given an empty table with 3 rows and C columns, together with an integer S. Hongjun writes one nonnegative integer in every cell of the table.
Take three cells, one from each of the three rows. If the center of one of them is the midpoint of the segment joining the centers of the other two, the three cells are called balanced. If the three cells lie in column a of row 1, column b of row 2, and column c of row 3, this condition is the same as a+c=2b. The picture below shows one balanced set of three cells when C=8.

Hongjun wants to fill the table so that for every balanced set of three cells, the numbers written in those three cells add up to S. For two tables A and B, let A(i,j) and B(i,j) be the numbers written in row i and column j. The two tables are different if A(i,j)=B(i,j) for at least one pair i, j. Given C and S, write a program that counts the tables Hongjun can write.