#include using namespace std; using LL=long long; using ULL=unsigned long long; #define rep(i,n) for(int i=0; i<(n); i++) LL X,Y,Z; LL F[45]; int main(){ cin>>X>>Y>>Z; if(X!=Z) swap(Y,Z); if(Y!=Z) swap(X,Z); F[0]=1;F[1]=0; for(int i=2; i<45; i++) F[i]=F[i-1]+F[i-2]; pair ans={1000000000000,-1}; if(X!=Y) rep(i,44) rep(j,44){ LL D=F[j+1]*F[i]-F[i+1]*F[j]; if(D==0) continue; LL A=F[j+1]*X-F[i+1]*Y; LL B=F[i]*Y-F[j]*X; if(A%D) continue; A/=D; if(A<=0) continue; if(B%D) continue; B/=D; if(B<=0) continue; bool ok=false; rep(k,44) if(Z==A*F[k]+B*F[k+1]) ok=true; if(!ok) continue; ans=min(ans,make_pair(A,B)); } else for(int i=1; i<44; i++){ LL B=X-F[i]; if(B%F[i+1]) continue; B/=F[i+1]; if(B<=0) continue; ans=min(ans,make_pair(1ll,B)); } if(ans.second==-1) cout<<-1<