#include <bits/stdc++.h>
using namespace std;
int dx[6] = {-1, -2, -1, 1, 2, 1};
int dy[6] = {2, 0, -2, -2, 0, 2};
int main() {
  long long n;
  scanf("%I64d", &n);
  if (n == 0)
    printf("0 0\n");
  else {
    long long d = 1;
    long long l = 1, r = (1LL << 31) - 1;
    while (l < r) {
      long long mid = (l + r) / 2;
      long long sum = mid * (mid + 1) / 2;
      if (sum <= n / 6)
        l = mid + 1;
      else
        r = mid;
    }
    n = n - r * (r - 1) * 3;
    d = r;
    if (n == 0) {
      n = n + 6 * (d - 1);
      d--;
    }
    int pos = 0;
    for (int i = 0; i < 6; i++) {
      if (n > d) {
        pos = (i + 1) % 6;
        n -= d;
      } else
        break;
    }
    long long x, y;
    if (pos == 0) x = d * 2, y = 0;
    if (pos == 1) x = d, y = d * 2;
    if (pos == 2) x = -d, y = d * 2;
    if (pos == 3) x = -d * 2, y = 0;
    if (pos == 4) x = -d, y = -d * 2;
    if (pos == 5) x = d, y = -d * 2;
    x = x + n * dx[pos];
    y = y + n * dy[pos];
    printf("%I64d %I64d\n", x, y);
  }
  return 0;
}
