#include <bits/stdc++.h>
using namespace std;
long long int x, y;
int main() {
  long long int n, p = 1, c, b;
  double d;
  cin >> n;
  if (n == 0) {
    x = 0;
    y = 0;
  } else {
    b = (n - 1) / 6;
    d = sqrt(double(b * 2));
    for (p = int(d);; p++) {
      if (b - p * (p + 1) / 2 < 0) break;
    }
    n = n - 6 * p * (p - 1) / 2;
    c = n / p;
    n = n % p;
    if (c == 0) {
      x = 2 * p - n;
      y = 0 + 2 * n;
    }
    if (c == 1) {
      x = p - 2 * n;
      y = 2 * p;
    }
    if (c == 2) {
      x = -p - n;
      y = 2 * p - 2 * n;
    }
    if (c == 3) {
      x = -2 * p + n;
      y = 0 - 2 * n;
    }
    if (c == 4) {
      x = -p + 2 * n;
      y = -2 * p;
    }
    if (c == 5) {
      x = p + n;
      y = -2 * p + 2 * n;
    }
    if (c == 6) {
      x = 2 * p;
      y = 0;
    }
  }
  cout << x << " " << y << endl;
  return 0;
}
