游客 Signup | Login
中文 | En

3499 - 他们是互补的

对于两个数对<a, b> 和 <c, d>,如果  a+d 等于 b+c,并且a!=cb!=d, 那么我们就称<a, b> 和 <c, d>是互补的。

现给你一个整数n (1<= n<= 1000),请问<0, 0>, <0, 1>, <0, 2>, ... , <0, n>, <1, 0 >, ... , <n, n>这些满足<x, y> (0<=x <=n, 0<=y <=n)的数对中,有多少互补的。约定   {<1, 3>, <2,4>} 和 {<2, 4>,<1, 3>}为一种答案。


Input

多组数据。每组数据包含一个整数n1<= n<= 1000

Output

对于每组数据输出一行表示答案。

Examples

Input

1
2
10

Output

1
5
385

Hint

n=1的时候,{<0,0>,<1,1>};

n=2的时候,{<0,0>,<1,1>},{<1,1>,<2,2>},{<0,0>,<2,2>},{<1,0>,<2,1>},{<0,1>,<2,1>};

Solution C++

#include <stdio.h>
#include <string.h>

int n;

int main(){
	//freopen("data.in","r",stdin);
	//freopen("data1.out","w",stdout);
	while(scanf("%d",&n) != EOF){
		/*int m = n+1;
		int ans = 0;
		for(int i = 0; i <= n; i++){
			if(i == 0) ans += m * (m-1) / 2;
			else ans += m * (m-1);
			m -= 1; 
		}
		printf("%d\n",ans);*/
		 
		// sigma(n^2);
		printf("%d\n",n*(n+1)*(2*n+1)/6);
	}
	return 0;
}


Hint

n=1的时候,{<0,0>,<1,1>};

n=2的时候,{<0,0>,<1,1>},{<1,1>,<2,2>},{<0,0>,<2,2>},{<1,0>,<2,1>},{<0,1>,<2,1>};

Time Limit 1 second
Memory Limit 128 MB
Discuss Stats
上一题 下一题