#include<cstdio> using namespace std; bool isexist[3012505]={1}; int res[500005]={0}; int main() { int temp; for (int m=1;m<=500000;m++) { temp=res[m-1]-m; if((temp)>0 && !isexist[temp]) { isexist[temp]=1; res[m]=res[m-1]-m; } else { res[m]=res[m-1]+m; if(!isexist[res[m]]) isexist[res[m]]=1; } } while(scanf("%d",&temp)!=EOF && (temp!=-1)) printf("%d/n",res[temp]); }