#include <bits/stdc++.h>
using namespace std;
struct p {
  double x, y;
  p() {}
  p(double x, double y) : x(x), y(y) {}
  p operator+(p q) { return p(x + q.x, y + q.y); }
  p operator-(p q) { return p(x - q.x, y - q.y); }
  p operator*(double q) { return p(x * q, y * q); }
};
p f(long long n) {
  if (n == 0) return p(0, 0);
  long long a = 0ll, b = 1e9, c, m;
  while (a <= b) {
    c = (a + b) / 2ll;
    if (3ll * c * (c + 1ll) >= n) {
      m = c;
      b = c - 1ll;
    } else
      a = c + 1ll;
  }
  n = (n - 3ll * m * (m - 1ll)) % (6 * m);
  p h[6];
  h[0] = p(m * 2ll, 0);
  h[1] = p(m, m * 2ll);
  h[2] = p(-m, m * 2ll);
  h[3] = p(-m * 2ll, 0);
  h[4] = p(-m, -m * 2ll);
  h[5] = p(m, -m * 2ll);
  int u = floor((double)(n) / (double)(m)), v = ceil((double)(n) / (double)(m));
  double w = (double)(n % m) / (double)(m);
  return h[u % 6] + (h[v % 6] - h[u % 6]) * w;
}
int main() {
  long long n;
  cin >> n;
  p g = f(n);
  printf("%.0lf %.0lf\n", g.x, g.y);
  return 0;
}
