#include <bits/stdc++.h>
using namespace std;
int dx[]{-1, -2, -1, 1, 2, 1};
int dy[]{2, 0, -2, -2, 0, 2};
long long steps;
long long find_circle(long long step) {
  long long int l = 1, r = 6e8;
  while (l < r) {
    int m = (l + r + 1) / 2;
    long long total = ((1LL * m - 1) * (1LL * m) * 3);
    if (total == step) return m - 1;
    if (step < total)
      r = m - 1;
    else
      l = m;
  }
  return l;
}
vector<long long> coordinate(int cir) {
  long long went;
  went = (1LL * cir) * (1LL * cir - 1) * 3;
  steps -= went;
  long long x = 2 * (cir - 1);
  long long y = 0;
  vector<long long> ans;
  ans.push_back(x);
  ans.push_back(y);
  return ans;
}
int main() {
  cin >> steps;
  if (steps == 0) {
    cout << "0 0";
    return 0;
  }
  long long int pre = find_circle(steps);
  long long x, y;
  vector<long long> cac;
  cac = coordinate(pre);
  pre++;
  x = cac[0];
  y = cac[1];
  x += 2;
  int direct = 0;
  int k = 6;
  while (k-- && steps) {
    x += min(pre - 1, steps) * dx[direct];
    y += min(pre - 1, steps) * dy[direct];
    steps -= min(pre - 1, steps);
    direct++;
  }
  cout << x << " " << y;
}
