#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll dx[] = {1, -1, -2, -1, 1, 2};
ll dy[] = {2, 2, 0, -2, -2, 0};
ll cnt[] = {1, 0, 1, 1, 1, 1};
int main() {
  int i, j, k;
  ll x, y, cur;
  ll n;
  cin >> n;
  ll l, r, m, ans;
  l = 0, r = (ll)1e9;
  while (l < r) {
    m = (l + r + 1) / 2;
    long long tmp = m;
    tmp = tmp * (3 * m + 2);
    if (tmp > n)
      r = m - 1;
    else
      l = m;
  }
  x = y = 0;
  x = x + l * dx[4];
  y = y + l * dy[4];
  for (i = 0; i < 6; i++) {
    cnt[i] += l;
  }
  cur = l * (6 * l + 4) / 2;
  i = 0;
  while (cur < n) {
    ll d = min(cnt[i], n - cur);
    cur += d;
    x += dx[i] * d;
    y += dy[i] * d;
    cnt[i]++;
    i = (i + 1) % 6;
  }
  cout << x << " " << y << endl;
  return 0;
}
