#include <bits/stdc++.h>
using namespace std;
int di[6][2] = {{-1, 2}, {-2, 0}, {-1, -2}, {1, -2}, {2, 0}, {1, 2}};
int main() {
  ios::sync_with_stdio(false);
  cout.setf(ios::fixed);
  cout.precision(20);
  long long n;
  cin >> n;
  if (n == 0) return 0 * puts("0 0");
  long long l = 0, r = 2139062143, mid;
  while (l < r) {
    mid = l + (r - l + 1 >> 1);
    if (3 * (1 + mid) * mid < n)
      l = mid;
    else
      r = mid - 1;
  }
  pair<long long, long long> cnt = {(l + 1) * 2 - 1, 2};
  n -= 3 * (1 + l) * l + 1;
  int d = 0;
  long long k = l;
  while (n) {
    if (k == 0) {
      d = (d + 1) % 6;
      k = l + 1;
    }
    long long step = (k < n ? k : n);
    cnt = {cnt.first + di[d][0] * (k < n ? k : n),
           cnt.second + di[d][1] * (k < n ? k : n)};
    k -= step;
    n -= step;
  }
  cout << cnt.first << ' ' << cnt.second << '\n';
  return 0;
}
