#include <bits/stdc++.h>
using namespace std;
long long bs(long long n) {
  long long l = 0, r = 1e9, mid, ans = -1;
  while (l < r) {
    mid = (l + r) / 2;
    if ((long long)3 * mid * (mid + 1) <= n) {
      l = mid + 1;
      ans = mid;
    } else {
      r = mid;
    }
  }
  return ans;
}
int main() {
  long long num, x = 0, y = 0;
  cin >> num;
  if (num) {
    long long pos = bs(num);
    num -= 3 * (pos) * (pos + 1);
    if (num == 0) {
      y = 0;
      x = 2 * (pos);
    } else {
      pos++;
      long long hexedge = num / pos;
      long long pointnumber = num % pos;
      if (hexedge == 0)
        y = 2 * pointnumber, x = 2 * pos - pointnumber;
      else if (hexedge == 1)
        x = pos - 2 * pointnumber, y = 2 * pos;
      else if (hexedge == 2)
        y = 2 * pos - 2 * pointnumber, x = -pos - pointnumber;
      else if (hexedge == 3) {
        y = -2 * pointnumber, x = -2 * pos + pointnumber;
      } else if (hexedge == 4)
        x = -pos + 2 * pointnumber, y = -2 * pos;
      else if (hexedge == 5)
        x = pos + pointnumber, y = -2 * pos + 2 * pointnumber;
    }
  }
  cout << x << " " << y << endl;
}
