P14931 [AtCoder] Given are integers N and K.
提高-
题目描述

Given are integers N and K.
How many quadruples of integers (a,b,c,d) satisfy both of the following conditions?
- $1 \leq a,b,c,d \leq N$
- a+b-c-d=K

-----Constraints-----
- $1 \leq N \leq 10^5$
- -$2(N-1) \leq K \leq 2(N-1)$
- All numbers in input are integers.

-----Input-----
Input is given from standard input in the following format:
N K

-----Output-----
Print the answer.

-----Sample Input-----
2 1

-----Sample Output-----
4

Four quadruples below satisfy the conditions:
- (a,b,c,d)=(2,1,1,1)
- (a,b,c,d)=(1,2,1,1)
- (a,b,c,d)=(2,2,2,1)
- (a,b,c,d)=(2,2,1,2)

输入格式

见题面

输出格式

见题面

样例输入
2 1
样例输出
4