#include <bits/stdc++.h>
using namespace std;
template <typename T>
T in() {
  char ch;
  T n = 0;
  bool ng = false;
  while (1) {
    ch = getchar();
    if (ch == '-') {
      ng = true;
      ch = getchar();
      break;
    }
    if (ch >= '0' && ch <= '9') break;
  }
  while (1) {
    n = n * 10 + (ch - '0');
    ch = getchar();
    if (ch < '0' || ch > '9') break;
  }
  return (ng ? -n : n);
}
template <typename T>
inline T POW(T B, T P) {
  if (P == 0) return 1;
  if (P & 1)
    return B * POW(B, P - 1);
  else
    return (POW(B, P / 2) * POW(B, P / 2));
}
template <typename T>
inline T Gcd(T a, T b) {
  if (a < 0) return Gcd(-a, b);
  if (b < 0) return Gcd(a, -b);
  return (b == 0) ? a : Gcd(b, a % b);
}
template <typename T>
inline T Lcm(T a, T b) {
  if (a < 0) return Lcm(-a, b);
  if (b < 0) return Lcm(a, -b);
  return a * (b / Gcd(a, b));
}
long long Bigmod(long long base, long long power, long long MOD) {
  long long ret = 1;
  while (power) {
    if (power & 1) ret = (ret * base) % MOD;
    base = (base * base) % MOD;
    power >>= 1;
  }
  return ret;
}
bool isVowel(char ch) {
  ch = toupper(ch);
  if (ch == 'A' || ch == 'U' || ch == 'I' || ch == 'O' || ch == 'E')
    return true;
  return false;
}
long long ModInverse(long long number, long long MOD) {
  return Bigmod(number, MOD - 2, MOD);
}
bool isConst(char ch) {
  if (isalpha(ch) && !isVowel(ch)) return true;
  return false;
}
int toInt(string s) {
  int sm;
  stringstream second(s);
  second >> sm;
  return sm;
}
int Ans[6][2] = {{0, 0}, {1, 2}, {-1, 2}, {-2, 0}, {-1, -2}, {1, -2}};
long long int dp[6][2] = {{1, 2}, {-1, 2}, {-2, 0}, {-1, -2}, {1, -2}, {2, 0}};
long long int Dekhi(long long int mid) {
  long long int now =
      ((mid * (mid + 1LL)) / 2LL) * 5LL + (mid * (mid - 1LL)) / 2LL;
  return now;
}
int main() {
  long long int n;
  cin >> n;
  if (n <= 5) {
    cout << Ans[n][0] << " " << Ans[n][1] << endl;
    return 0;
  }
  long long int l = 1, h = 1000000000LL;
  long long int ans;
  long long int tp;
  while (l <= h) {
    long long int mid = (l + h) / 2LL;
    long long int now = Dekhi(mid);
    if (now >= n) {
      ans = mid;
      h = mid - 1LL;
    } else
      l = mid + 1;
  }
  tp = Dekhi(ans - 1LL);
  n -= tp;
  long long int a[7] = {0};
  for (int i = 0; i < 6; i++) a[i] = ans;
  a[1]--;
  long long int x = a[1] * dp[4][0], y = a[1] * dp[4][1];
  for (int i = 0; i < 6; i++) {
    if (a[i] >= n) {
      x = (x + dp[i][0] * n);
      y = (y + dp[i][1] * n);
      cout << x << " " << y << endl;
      break;
    } else {
      n -= a[i];
      x = (x + dp[i][0] * a[i]);
      y = (y + dp[i][1] * a[i]);
    }
  }
  return 0;
}
