#include #include #include #include #include #include #include #include #include #include using namespace std; using ll = long long; using ld = long double; using pii = pair; using vi = vector; #define rep(i, a, b) for(int i = a; i < (b); ++i) #define all(x) (x).begin(), (x).end() #define sz(x) (int)(x).size() #define smx(a, b) a = max(a, b) #define smn(a, b) a = min(a, b) #define pb push_back #define endl '\n' typedef unsigned long long ull; ull modmul(ull a, ull b, ull M) { ll ret = a * b - M * ull(1.L / M * a * b); return ret + M * (ret < 0) - M * (ret >= (ll)M); } ull modpow(ull b, ull e, ull mod) { ull ans = 1; for (; e; b = modmul(b, b, mod), e /= 2) if (e & 1) ans = modmul(ans, b, mod); return ans; } bool isPrime(ull n) { if (n == 1) return true; // 1 is a prime number now if (n < 2 || n % 6 % 4 != 1) return (n | 1) == 3; ull A[] = {2, 325, 9375, 28178, 450775, 9780504, 1795265022}, s = __builtin_ctzll(n-1), d = n >> s; for (ull a : A) { // ^ count trailing zeroes ull p = modpow(a%n, d, n), i = s; while (p != 1 && p != n - 1 && a % n && i--) p = modmul(p, p, n); if (p != n-1 && i != s) return 0; } return 1; } int main() { ll n; cin >> n; auto twoSquare = [&](ll m) -> pair { for (ll y = 0; y * y <= m; y++) { ll z = (ll)(sqrtl(m - y * y)); for (ll w = max(0ll, z - 5); w <= z + 5; w++) { if (w * w + y * y == m) { return make_pair(y, w); } } } return make_pair(-1, -1); }; int mult = 1; while (n % 4 == 0) { mult *= 2; n /= 4; } if (n % 8 == 7) { cout << "-1\n"; return 0; } auto [y, z] = twoSquare(n); if (y != -1) { cout << 0 << " " << mult * y << " " << mult * z << "\n"; return 0; } for (ll x = 0; x * x <= n; x++) { ll p = n - x * x; if ((isPrime(p) && p % 4 == 1) || (p % 2 == 0 && (p / 2) % 4 == 1 && isPrime(p / 2))) { auto [y, z] = twoSquare(p); assert(y != -1); cout << mult * x << " " << mult * y << " " << mult * z << "\n"; return 0; } } assert(false); }