#include <iostream>
#include<iomanip>
#include <cmath>
using namespace std;
int main() {
double a,b,c,d,x;
cin >> x >>a >> b >>c >> d ;
cout << fixed << setprecision(7) << a* pow(x,3) + b* pow(x,2) + c* x + d << endl;
return 0;
}
#include <iostream>
using namespace std;
int main() {
double a,b,c,d,x;
cin >> x >>a >> b >>c >> d ;
printf("%.7f",a*x*x*x+b*x*x+c*x+d);
return 0;
}