#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define X first #define Y second #define pb push_back #define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X)) #define rrep(X,Y) for (int (X) = (Y-1);(X) >=0;--(X)) #define repe(X,Y) for ((X) = 0;(X) < (Y);++(X)) #define peat(X,Y) for (;(X) < (Y);++(X)) #define all(X) (X).begin(),(X).end() #define rall(X) (X).rbegin(),(X).rend() using namespace std; typedef long long ll; typedef pair pii; typedef pair pll; template using vv=vector>; template ostream& operator<<(ostream &os, const vector &t) { os<<"{"; rep(i,t.size()) {os< ostream& operator<<(ostream &os, const pair &t) { return os<<"("<=b)return pii(a,b); return min(inv(b-a,a),pll(a,b)); } int main(){ ios_base::sync_with_stdio(false); cout< a(3),f={0,1}; while(f.back()<2e9) f.pb(f.back()+f[f.size()-2]); rep(i,3) cin>>a[i]; sort(all(a)); a.erase(unique(all(a)),a.end()); //cout<1){ rep(i,m-1){ ll x=a[1]-f[i]*a[0]; if(x%f[i+1])continue; x/=f[i+1]; int flg=1; if(a.size()==3){ rep(j,m-1){ ll tmp=f[j]*a[0]+f[j+1]*x; if(tmp>a[2]){flg=0;break;} if(tmp==a[2])break; } } if(flg)re=min(re,inv(a[0],x)); } }else{ re.X=1; if(a[0]==1) re.Y=1; rep(i,m-1){ if((a[0]-f[i])%f[i+1]==0) re.Y=min(re.Y,(a[0]-f[i])/f[i+1]); } } if(re.X==INF) cout<<-1<