#include double cal(double a){ double z; if (a < 0)z=0; else if (a > 0 && a <= 10)z=a*a+a; else if (a > 10 && a <= 40)z = 3*a-4; else z = 0; return z;}int main(){ double a, z; scanf ("%lf", &a); z = cal(a); printf ("%f\n", z); return 0;}