#include <stdio.h>
#include <math.h>
int main()
{
double x,y;
scanf("%lf",&x);
if(x<0)
y = (x+1)*(x+1) + 2*x+1/x;
else
y = sqrt(x);
printf("%.2lf",y);
return 0;
}
int main() {
float x,y=0.0f;
scanf("%f",&x);
if(x<0.0f){
y=pow((x+1.0f),2)+2.0f*x+1.0f/x;
}else{
y=sqrt(x);
}
printf("%f\n",y);
return 0;
}