#include <bits/stdc++.h>
using namespace std;
long long dx[] = {-1, -2, -1, 1, 2, 1};
long long dy[] = {2, 0, -2, -2, 0, 2};
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long n, m;
  cin >> n;
  m = (sqrt(4 * (n / 3) + 1) - 1) / 2;
  while (m * (m + 1) * 3 < n) m++;
  if (n == 3 * m * (m + 1)) {
    cout << 2 * m << " 0";
    exit(0);
  }
  n -= 3 * m * (m - 1);
  long long x = 2 * m, y = 0;
  if (n >= m) x = m, y = 2 * m;
  if (n >= 2 * m) x = -m, y = 2 * m;
  if (n >= 3 * m) x = -2 * m, y = 0;
  if (n >= 4 * m) x = -m, y = -2 * m;
  if (n >= 5 * m) x = m, y = -2 * m;
  x += (n % m) * dx[n / m];
  y += (n % m) * dy[n / m];
  cout << x << " " << y << endl;
}
