#include <bits/stdc++.h>
using namespace std;
long long n;
long long mod = 1e9 + 7, a[300000];
long long binpow(long long x, long long y) {
  if (y == 0) return 1;
  if (y % 2) return x * binpow(x, y - 1) % mod;
  long long t = binpow(x, y / 2);
  return t * t % mod;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  if (n == 0) {
    cout << "0 0";
    return 0;
  }
  if (n == 1) {
    cout << "1 2" << endl;
    return 0;
  }
  n -= 1;
  long long l = 0, r = 1e9;
  while (r - l > 1) {
    long long mid = (r + l) / 2;
    if (6 * mid * (mid + 1) / 2 + mid > n)
      r = mid - 1;
    else
      l = mid;
  }
  if (6 * r * (r + 1) / 2 + r <= n) l = r;
  n -= 6 * l * (l + 1) / 2 + l;
  l++;
  if (n < l) {
    cout << l - 2 * n << " " << 2 * l << endl;
    return 0;
  }
  n -= l;
  if (n < l) {
    cout << -l - n << " " << 2 * (l - n);
    return 0;
  }
  n -= l;
  if (n < l) {
    cout << -2 * l + n << " " << -2 * n;
    return 0;
  }
  n -= l;
  if (n < l) {
    cout << 2 * n - l << " " << -2 * l;
    return 0;
  }
  n -= l;
  if (n < l + 1) {
    cout << l + n << " " << -2 * l + 2 * n;
    return 0;
  }
  n -= l + 1;
  cout << 2 * l + 1 - n << " " << 2 + 2 * n;
}
