#include <iostream>
#include <iomanip>
#include <cmath>
// 定义多项式函数 f(x) = ax^3 + bx^2 + cx + d
double polynomial(double x, int a, int b, int c, int d) {
return a * std::pow(x, 3) + b * std::pow(x, 2) + c * x + d;
}
// 使用梯形积分法计算区间 [lower, upper] 上的积分
double trapezoidal_integral(double (*f)(double, int, int, int, int), double lower, double upper, int n, int a, int b, int c, int d) {
double h = (upper - lower) / n;
double total = (f(lower, a, b, c, d) + f(upper, a, b, c, d)) / 2.0;
for (int i = 1; i < n; ++i) {
total += f(lower + i * h, a, b, c, d);
}
return total * h;
}
int main() {
int a, b, c, d, l;
// 读取输入
std::cin >> a >> b >> c >> d >> l;
// 设置积分区间和步数
double lower_bound = 0.0;
double upper_bound = static_cast<double>(l);
int n = 1000; // 分段数
// 计算积分
double area = trapezoidal_integral(polynomial, lower_bound, upper_bound, n, a, b, c, d);
// 输出结果,保留两位小数
std::cout << std::fixed << std::setprecision(2) << area << std::endl;
return 0;
}