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