double D,px,py,vx,vy,a,p,l;
main(){
	for(;scanf("%lf",&D),D;){
		scanf("%lf%lf%lf%lf",&px,&py,&vx,&vy);
		p=px*vx+py*vy;
		a=hypot(px,py);
		l=D+1;
		if(fabs(px*vy-py*vx)<1e-9)
			l=p<0?a:2-a;
		if(D>=l)
			printf("%.8f\n",l);
		else
			puts("impossible");
	}
	exit(0);
}