#include <bits/stdc++.h>
using namespace std;
long long n;
int main() {
  cin.tie(0), cout.tie(0), ios::sync_with_stdio(0);
  cin >> n;
  long long l = 0, r = 1000000000;
  while (l < r) {
    long long mid = (l + r) / 2;
    if (mid * (mid + 1) * 3 > n)
      r = mid;
    else
      l = mid + 1;
  }
  if (n == 0) {
    cout << "0 0";
    return 0;
  } else if (n == 1) {
    cout << "1 2";
    return 0;
  } else if (n == 2) {
    cout << "-1 2";
    return 0;
  } else if (n == 3) {
    cout << "-2 0";
    return 0;
  } else if (n == 4) {
    cout << "-1 -2";
    return 0;
  } else if (n == 5) {
    cout << "1 -2";
    return 0;
  }
  l--;
  long long cordx = 2 * l, cordy = 0, sum = l * (l + 1) * 3;
  while (sum < n) {
    cordy += 2;
    cordx += 1;
    sum++;
    if (sum == n) break;
    int count1 = 0;
    if (sum + l >= n) {
      long long k = n - sum;
      cordy += 2 * k;
      cordx -= 1 * k;
      cout << cordx << " " << cordy;
      return 0;
    } else {
      sum += l;
      cordy += l * 2;
      cordx -= l;
      if (sum + l + 1 >= n) {
        long long k = n - sum;
        cordx -= 2 * k;
        cout << cordx << " " << cordy;
        return 0;
      } else {
        sum += l + 1;
        cordx -= (l + 1) * 2;
        if (sum + l + 1 >= n) {
          long long k = n - sum;
          cordx -= 1 * k;
          cordy -= 2 * k;
          cout << cordx << " " << cordy;
          return 0;
        } else {
          sum += l + 1;
          cordy -= (l + 1) * 2;
          cordx -= (l + 1);
          if (sum + l + 1 >= n) {
            long long k = n - sum;
            cordx += 1 * k;
            cordy -= 2 * k;
            cout << cordx << " " << cordy;
            return 0;
          } else {
            sum += l + 1;
            cordy -= (l + 1) * 2;
            cordx += (l + 1);
            if (sum + l + 1 >= n) {
              long long k = n - sum;
              cordx += 2 * k;
              cout << cordx << " " << cordy;
              return 0;
            } else {
              sum += l + 1;
              cordx += 2 * (l + 1);
              long long k = n - sum;
              cordy += 2 * k;
              cordx += 1 * k;
              cout << cordx << " " << cordy;
              return 0;
            }
          }
        }
      }
    }
  }
  cout << cordx << " " << cordy;
}
