#include <bits/stdc++.h>
using namespace std;
int main() {
	// 1. define
	double x, a, b, c, d;
	// 2. input
	cin >> x >> a >> b >> c >> d;
	// 3. process
	double ans = a * x * x * x + b * x * x + c * x + d;
	// 4. output
	cout << fixed << setprecision(7) << ans << endl;
	return 0;
}