#include <bits/stdc++.h>
using namespace std;
const long long MOD = (long long)1e9 + 7;
int movesx[7] = {1, -1, -2, -1, 1, 2};
int movesy[7] = {
    2, 2, 0, -2, -2, 0,
};
long long x = 0, y = 0;
void doWork(long long n) {
  long long a = -1, b = 1.e9, m, ar;
  while (b - a > 1) {
    m = (b + a) / 2;
    ar = (2 + 3 * m) * m;
    if (n >= ar) {
      a = m;
    } else {
      b = m;
    }
  }
  x += 1LL * a * movesx[4];
  y += 1LL * a * movesy[4];
  n -= (5 + 3 * (a - 1)) * a;
  long long t = a + 1;
  while (true) {
    for (int i = 0; i < 6; ++i) {
      if (i == 1) {
        if ((t - 1) <= n) {
          x += 1LL * (t - 1) * movesx[i];
          y += 1LL * (t - 1) * movesy[i];
          n -= (t - 1);
        } else {
          x += 1LL * n * movesx[i];
          y += 1LL * n * movesy[i];
          n = 0;
        }
        if (n == 0) return;
      } else {
        if (t <= n) {
          x += 1LL * t * movesx[i];
          y += 1LL * t * movesy[i];
          n -= t;
        } else {
          x += 1LL * n * movesx[i];
          y += 1LL * n * movesy[i];
          n = 0;
        }
        if (n == 0) return;
      }
    }
  }
}
int main() {
  long long n;
  cin >> n;
  doWork(n);
  cout << x << " " << y << endl;
}
