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