求条:
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ULL unsigned long long
#define INT __int128
#define tbl ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
//#pragma GCC optimize(3,"Ofast","inline")
//inline long long read(){int x=0,f=1;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0',&& ch<='9')x=x*10+ch-'0',ch=getchar();return x*f;}
//void write(long long x){if(x<0)putchar('-'),x=-x;if(x>9)write(x/10);putchar(x%10+'0');return;}
double a,b,c,d,sum=0;
int aaa(double a,double b,double c,double d){
if(a<c||b<d)return -1;
else {
while(a!=c){
if(a-c<=a/2)a=c;
else a-=a/2;
sum++;
}
while(b!=d){
if(b-d<=b/2)b=d;
else b-=b/2;
sum++;
}
return sum;
}
}
signed main() {
cin>>a>>b>>c>>d;
int t1=aaa(a,b,c,d),t2=aaa(b,a,c,d);
if(t1==-1&&t2!=-1)cout<<t2;
else if(t2==-1&&t1!=-1)cout<<t1;
else cout<<min(t1,t2);
return 0;
}