#include <bits/stdc++.h>
using namespace std;
template <typename S, typename T>
ostream& operator<<(ostream& out, pair<S, T> const& p) {
  out << '(' << p.first << ", " << p.second << ')';
  return out;
}
template <typename T>
ostream& operator<<(ostream& out, vector<T> const& v) {
  int l = v.size();
  for (int i = 0; i < l - 1; i++) out << v[i] << ' ';
  if (l > 0) out << v[l - 1];
  return out;
}
long long n;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n;
  if (n == 0) {
    cout << "0 0" << endl;
    return 0;
  }
  long long lo = 0, hi = 600000000, mid;
  while (lo + 1 < hi) {
    mid = (lo + hi) / 2;
    if (1 + (mid * (mid + 1)) * 3 <= n + 1)
      lo = mid;
    else
      hi = mid;
  }
  long long x, y;
  if (lo == 0) {
    x = 2, y = 0;
    lo++;
  } else {
    n -= (lo * (lo + 1) * 3);
    lo++;
    x = 2 * (lo), y = 0;
  }
  if (n == 0) {
    x -= 2;
  }
  for (int i = 0; i < 6 and n > 0; i++) {
    if (lo <= n) {
      if (i == 0) {
        x -= lo;
        y += 2 * lo;
      } else if (i == 1) {
        x -= 2 * lo;
      } else if (i == 2) {
        x -= lo;
        y -= 2 * lo;
      } else if (i == 3) {
        x += lo;
        y -= 2 * lo;
      } else if (i == 4) {
        x += 2 * lo;
      } else if (i == 5) {
        x += lo;
        y += 2 * lo;
      }
      n -= lo;
    } else {
      lo = n;
      if (i == 0) {
        x -= lo;
        y += 2 * lo;
      } else if (i == 1) {
        x -= 2 * lo;
      } else if (i == 2) {
        x -= lo;
        y -= 2 * lo;
      } else if (i == 3) {
        x += lo;
        y -= 2 * lo;
      } else if (i == 4) {
        x += 2 * lo;
      } else if (i == 5) {
        x += lo;
        y += 2 * lo;
      }
      break;
    }
  }
  cout << x << " " << y << endl;
  return 0;
}
