#include <bits/stdc++.h>
using namespace std;
long long cal(long long u) { return u * (u - 1) * 3; }
int main() {
  long long n;
  while (scanf("%I64d", &n) != EOF) {
    if (n == 0) {
      printf("0 0\n");
      continue;
    }
    long long tn = n;
    long long dis = sqrt(1.0 * n / 3) + 3;
    while (cal(dis - 1) >= n) dis--;
    n -= cal(dis - 1);
    int flag = 0;
    int f = 1;
    while (n) {
      long long dx = 0;
      dx = dis - 1;
      if (n > dx)
        n -= dx, flag++;
      else
        break;
    }
    dis -= 1;
    long long x, y, tx, ty;
    if (flag == 0)
      x = 2 * dis, y = 0, tx = -1, ty = 2;
    else if (flag == 1)
      x = dis, y = 2 * dis, tx = -2, ty = 0;
    else if (flag == 2)
      x = -dis, y = 2 * dis, tx = -1, ty = -2;
    else if (flag == 3)
      x = -2 * dis, y = 0, tx = 1, ty = -2;
    else if (flag == 4)
      x = -dis, y = -2 * dis, tx = 2, ty = 0;
    else
      x = dis, y = -2 * dis, tx = 1, ty = 2;
    x += tx * n;
    y += ty * n;
    printf("%I64d %I64d\n", x, y);
  }
  return 0;
}
