#include<cmath> #include<algorithm> using namespace std; int main() { long long n; scanf("%lld", &n); if(n == 0) { printf("0 0"); return 0; } // for(int i = 1; i < 20; i++){ // n = i; n++; long long len = 1; long long sum = len; while(sum < n) { sum += len*6; len++; } long long now = n -1 - (len - 1)*(len-2)*3; //printf("now %d\n",now); long long Time = now / (len - 1); now %= len - 1; long long x ,y; // printf("%d %d\n",Time, len); if(Time == 0) { x = 2 * (len - 1); y = 0; while(now--) x--,y+=2; } else if(Time == 1) { x = len - 1; y = 2*(len - 1); while(now--) x-=2; } else if(Time == 2) { x = 1 - len; y = 2*(len - 1); while(now--) x--,y-=2; } else if(Time == 3) { x = 2*(1-len); y = 0; while(now--) x++,y-=2; } else if(Time == 4) { x = 1-len; y = 2*(1 - len); while(now--) x+=2; } else if(Time == 5) { x = len - 1; y = 2*(1 - len); while(now--) x++,y+=2; } else { x = 2*(len - 1); y = 0; } printf("%lld %lld\n",x,y); // } return 0; }