#include <bits/stdc++.h>
using namespace std;
using LL = long long;
struct point {
  int x, y;
  point operator+(point a) { return {x + a.x, y + a.y}; }
  point operator*(int k) { return {k * x, k * y}; }
};
point dir(int c) {
  if (c == 0) return {1, 2};
  if (c == 1) return {-1, 2};
  if (c == 2) return {-2, 0};
  if (c == 3) return {-1, -2};
  if (c == 4) return {1, -2};
  if (c == 5) return {2, 0};
}
int main() {
  auto rt = [&](long double n) {
    long double a = 3, b = 2, c = 1 - n;
    long double d = b * b - 4 * a * c;
    return (-b + sqrt(d)) / (2 * a);
  };
  auto f = [&](int x) { return 3ll * x * x + 2 * x; };
  LL n;
  cin >> n;
  if (!n) {
    puts("0 0");
    return 0;
  }
  int x = int(rt(n));
  n -= f(x);
  int c = 0;
  for (; c < 6; c++) {
    if (x + (c != 1) >= n) break;
    n -= x + (c != 1);
  }
  point p;
  if (c == 0) p = {x, -2 * x};
  if (c == 1) p = {1 + 2 * x, 2};
  if (c == 2) p = {x + 1, (x + 1) * 2};
  if (c == 3) p = {-x - 1, (x + 1) * 2};
  if (c == 4) p = {-2 * (x + 1), 0};
  if (c == 5) p = {-x - 1, (x + 1) * (-2)};
  p = p + dir(c) * n;
  cout << p.x << " " << p.y << endl;
  return 0;
}
