#include <bits/stdc++.h>
using namespace std;
int main(int argc, const char* argv[]) {
  long long n;
  cin >> n;
  if (n == 0)
    printf("0 0\n");
  else {
    long long a = n / 3;
    long long b = floor(sqrt(a) + 0.5);
    while (3 * b * (b + 1) >= n) b--;
    long long l = b + 1;
    long long c = (n - 1 - 3 * b * (b + 1)) / l;
    long long d = (n - 1 - 3 * b * (b + 1)) % l;
    long long x, y;
    switch (c) {
      case 0:
        x = l, y = 2 * l;
        x += l - 1 - d, y -= 2 * (l - d - 1);
        break;
      case 1:
        x = -l, y = 2 * l;
        x += (l - 1 - d) * 2;
        break;
      case 2:
        x = -2 * l, y = 0;
        x += l - 1 - d;
        y += 2 * (l - 1 - d);
        break;
      case 3:
        x = -l, y = -2 * l;
        x -= l - 1 - d;
        y += 2 * (l - 1 - d);
        break;
      case 4:
        x = l, y = -2 * l;
        x -= 2 * (l - 1 - d);
        break;
      case 5:
        x = 2 * l, y = 0;
        x -= l - 1 - d;
        y -= 2 * (l - 1 - d);
        break;
      default:
        break;
    }
    cout << x << ' ' << y << endl;
  }
  return 0;
}
