#include #include using namespace std; typedef long long ll; typedef vector vec; typedef vector mat; typedef vector Vec; typedef vector Mat; typedef pair P; typedef pair Pd; typedef priority_queue,greater

> P_queue; typedef priority_queue,greater> Pd_queue; const ll MOD=998244353; const ll mod=1000000007; const ll INF=1e15; const double DEL=1e-3; vec dx={1,0,-1,0}; vec dy={0,1,0,-1}; #define REP(i,a,b) for(int i=(int)a;i<(int)b;i++) #define rep(i,n) REP(i,0,n) #define pb push_back #define mp make_pair #define ALL(a) a.begin(),a.end() #define SORT(a) sort(ALL(a)) #define U_ERASE(V) V.erase(unique(ALL(V)), V.end()); #define ADD(a,b) a=(a+b)%mod #define CHECK cout<<"arrived"<y) return hantei(a,b,y,x); rep(i,N) { if(a*A[i]+b*B[i]==x){ REP(j,i,N){ if(a*A[j]+b*B[j]==y) return true; if(a*A[j]+b*B[j]>y) return false; } } if(a*A[i]+b*B[i]>x) return false; } return false; } bool Hantei(ll a, ll b, ll x){ ll BIG=N-1, SMALL=0; while(BIG>SMALL+1){ ll MID=(BIG+SMALL)/2; //cout<x) BIG=MID; } if(BIG==N-1) if(a*A[BIG]+b*B[BIG]==x) return true; if(SMALL==0) if(a*A[SMALL]+b*B[SMALL]==x) return true; return false; } P Solve(){ int Count=N-1; REP(j,1,Y+1){ for(int i=Count;i>=0;i--) { ll A=Solving(j,Z,i); if(A==-2) Count--; if(A>=0){ if(hantei(j,A,X,Y)) return mp(j,A); } } } return mp(-1,-1); } int main(){ REP(i,2,120){ A.pb(A[i-1]+A[i-2]); B.pb(B[i-1]+B[i-2]); if(B[i]>1e9+10) break; } N=B.size(); vec I(3); rep(i,3) cin>>I[i]; sort(ALL(I)); X=I[0]; Y=I[1]; Z=I[2]; P ans=Solve(); if(ans.first<0) cout<<-1<