#include #include using namespace std; const long BASE=1e9; const int WD=4; struct ll { long dat[WD+1]; ll(long X=0) { bool neg=false; if(X<0) { neg=true; X=-X; } for(int i=0;i0); } dat[WD]=1-dat[WD]; } } void add(const ll&B) { for(int i=0;i<=WD;i++) { dat[i]+=B.dat[i]; if(dat[i]>=BASE) { dat[i]-=BASE; dat[i+1]++; } } dat[WD]%=2; } void mul(ll B) { bool negflag=false; if(isneg()) { negflag=!negflag; negate(); } if(B.isneg()) { negflag=!negflag; B.negate(); } for(int i=WD-1;i>=0;i--) { for(int j=WD-1-i;j>0;j--) { dat[i+j]+=dat[i]*B.dat[j]; } dat[i]*=B.dat[0]; } for(int i=0;i>a>>b>>c; A=ll(a); B=ll(b); C=ll(c); long Lx=-1e9,Rx=1e9; while(Rx-Lx>1) { long Mx=(Lx+Rx)/2; if(f(Mx).isneg())Lx=Mx; else Rx=Mx; } long alpha=Rx; D=ll(a+alpha); E=ll(alpha*alpha); E.add(B); A.mul(ll(alpha)); E.add(A); a+=alpha; a=-a; long BL=-1e9,BR,CL,CR=1e9; if(a%2==0) { BR=a/2; CL=a/2; } else { BR=a>=0?a/2+1:a/2; CL=a>=0?a/2:a/2-1; } while(BR-BL>1) { long BM=(BR+BL)/2; if(g(BM).isneg())BR=BM; else BL=BM; } while(CR-CL>1) { long CM=(CR+CL)/2; if(g(CM).isneg())CL=CM; else CR=CM; } long ans[3]={alpha,BL,CR}; sort(ans,ans+3); cout<