#include<bits/stdc++.h> using namespace std; int main() { double a,b,x,c,d; cin>>x>>a>>b>>c>>d; printf("%.5lf",a*x*x*x+b*x*x+c*x+d); }