#include <stdio.h>
int main ()
{
double a,b,c,d,x;
double y;
double e,f,g;
scanf("%lf %lf %lf %lf %lf",&x,&a,&b,&c,&d);
e = a * x * x * x;
f = b * x * x;
g = c * x;
y = e+f+g+d;
printf("%.7lf",y);
return 0;
}
#include <stdio.h>
int main ()
{
double a,b,c,d,x;
double y;
double e,f,g;
scanf("%lf %lf %lf %lf %lf",&x,&a,&b,&c,&d);
e = a * x * x * x;
f = b * x * x;
g = c * x;
y = e+f+g+d;
printf("%.7lf",y);
return 0;
}