//纯粹暴力AC,必须记住大数组一定要开成全局变量,因为函数里面的定义的变量都是放在栈堆中,太大会溢出即stack overflow#include
#include
using namespace std;int arr[500001];bool used[3012500];int main(){ int n; arr[0] = 0; memset(used,0,sizeof(used)); used[0] = 1; for(int i = 1;i <= 500000;++i) { if(arr[i-1] - i > 0 && !used[arr[i-1]-i]) { arr[i] = arr[i-1] - i; used[arr[i]] = 1; } else { arr[i] = arr[i-1] + i; used[arr[i]] = 1; } } while(cin >> n) { if(n == -1) return 0; cout << arr[n] << endl; } return 0;}