#include using namespace std; struct cww{ cww(){ ios::sync_with_stdio(false);cin.tie(0); cout< VD; typedef vector VVD; D one=1; D zero=0; D vecmul(const VD a,const VD b){ D res=0; int size=a.size(); for(int i=0;i>(istream &is,__float128 &f){ double x; is>>x;f=x; return is; } const D eps=1e-9; int main(){ D p,q,a,b,c,d,s,p1,p0,ps,res; cin>>p>>q; //q==0だけ場合分け if(q==0){ res=(p+2)/(4-p); } else{ //p1=a*p0+bを求める { VD x={3,1,0}; VD y={-1,0,1}; D t=q; while(t<1){ D nt=min(t+q,one); VVD mat={nxt(t),{1.0,0.0,0.0},{0.0,0.0,1.0}}; x=matmul(mat,x); y=matmul(mat,y); t=nt; } a=x[0];b=y[0]; } //p0=c*p1+dを求める { VD x={2,1,0}; VD y={-1,0,1}; D t=1-q; while(t>0){ D nt=max(t-q,zero); VVD mat={prv(t),{1.0,0.0,0.0},{0.0,0.0,1.0}}; x=matmul(mat,x); y=matmul(mat,y); t=nt; } c=x[0];d=y[0]; } //cout<