#include <bits/stdc++.h>
using namespace std;
void print(pair<long long, long long> x) {
  cout << x.first << " " << x.second << endl;
  exit(0);
}
pair<long long, long long> foo(pair<long long, long long> A,
                               pair<long long, long long> B, long long P,
                               long long Q) {
  pair<long long, long long> AB =
      make_pair(B.first - A.first, B.second - A.second);
  AB.first = AB.first * P / Q;
  AB.second = AB.second * P / Q;
  pair<long long, long long> res =
      make_pair(A.first + AB.first, A.second + AB.second);
  return res;
}
int main() {
  ios_base::sync_with_stdio(0);
  long long n;
  cin >> n;
  if (n == 0) {
    print(make_pair(0, 0));
  }
  long long L = 0, R = (long long)1e9 + 5;
  while (R - L > 1) {
    long long mid = (L + R) >> 1;
    if (mid * (mid + 1) * 3 < n)
      L = mid;
    else
      R = mid;
  }
  long long layer = R;
  long long prev_layer = R - 1;
  n -= prev_layer * (prev_layer + 1) * 3;
  cerr << "!" << n << " " << layer << endl;
  vector<pair<long long, long long>> a;
  a.push_back(make_pair(layer * 2, 0LL));
  a.push_back(make_pair(layer, layer * 2));
  a.push_back(make_pair(-layer, layer * 2));
  a.push_back(make_pair(-layer * 2, 0LL));
  a.push_back(make_pair(-layer, -layer * 2));
  a.push_back(make_pair(layer, -layer * 2));
  for (int i = 0; i <= 5; i++) {
    cerr << "!" << n << " " << layer * (i + 1) << endl;
    if (n <= layer * (i + 1)) {
      print(foo(a[i], a[(i + 1) % a.size()], n - i * layer, layer));
    }
  }
  return 0;
}
