#include using namespace std; using ll = long long; vector> find(vector X) { assert((int)X.size() == 2); vector Fib1(2), Fib2(2); Fib1[0] = 1; for (int i = 2;; i++) { ll x = Fib1[i - 2] + Fib1[i - 1]; if (x < 2e9) Fib1.emplace_back(x); else break; } Fib2[1] = 1; for (int i = 2;; i++) { ll x = Fib2[i - 2] + Fib2[i - 1]; if (x < 2e9) Fib2.emplace_back(x); else break; } int N = Fib1.size() - 1; vector> ret; for (int i = 0; i < N; i++) { for (int j = 0; j < N; j++) { //Fib1[i] Fib2[i] //Fib1[j] Fib2[j] ll det = Fib1[i] * Fib2[j] - Fib2[i] * Fib1[j]; if (det == 0) continue; //inv //Fib2[j]/det -Fib2[i]/det //-Fib1[j]/det Fib1[i]/det ll A = Fib2[j] * X[0] - Fib2[i] * X[1], B = -Fib1[j] * X[0] + Fib1[i] * X[1]; if (A % det == 0 && B % det == 0) { A /= det; B /= det; if (A > 0 && B > 0) { ret.push_back({A, B}); } } } } return ret; } int main() { vector X(3); for (int i = 0; i < 3; i++) { cin >> X[i]; } sort(X.begin(), X.end()); X.erase(unique(X.begin(), X.end()), X.end()); pair ans; if (X.size() == 1 || X.size() == 2) { if (X.size() == 1) X.insert(X.begin(), 1); auto V = find(X); sort(V.begin(), V.end()); ans = V[0]; } else if (X.size() == 3) { vector Y(2); Y[0] = X[0]; Y[1] = X[1]; auto V = find(Y); auto check = [](pair p, ll C) { ll A = p.first, B = p.second; if (A == C || B == C) return true; while (B < 2e9) { A += B; swap(A, B); if (B == C) return true; } return false; }; ans = {2e9, 2e9}; for (auto p : V) if (check(p, X[2])) if (p < ans) ans = p; if (ans.first == (ll)2e9) { cout << -1 << endl; return 0; } } cout << ans.first << " " << ans.second << endl; }