#include <iostream>
#include <cmath>
using namespace std;
double z(double x, double y){
return 1;//<-- место для ввода формулы нахождения координаты z.
}
double dl(double x, double y, double z){
return sqrt(x*x+y*y+z*z);//Длина вектора.
}
double ras(double xi, double xj, double yi, double yj){
double zii, zjj, zij, zji, v1x=0, v1y=0, v1z=0, v2x=0, v2y=0, v2z=0;
zii=z(xi, yi); //Найдём координату z каждой вершины треугольников.
zjj=z(xj, yj);
zij=z(xi, yj);
zji=z(xj, yi);
v1x=(yi-yj)*(zji-zii); //Вычислим векторное произведение векторов.
v1y=(zii-zij)*(xj-xi);
v1z=(yj-yi)*(xj-xi);
v2x=(yj-yi)*(zji-zjj);
v2y=(zjj-zij)*(xi-xj);
v2z=(yi-yj)*(xi-xj);
return (dl(v1x, v1y, v1z)+dl(v2x, v2y, v2z))/2;//Найдём площадь треугольников.
}
int main(){
double xi, xj, yi, yj, s=0, h;
int a, b, c, d;
cin >> a >> b >> c >> d >> h;
xi = a;
while(xi<=(b-h)){
yi=c;
xj=xi+h;
while(yi<(d-h)){
yj=yi+h;
s+=ras(xi, xj, yi, yj);
yi=yj;
}
xi=xj;
}
cout<<s;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8Y21hdGg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CmRvdWJsZSB6KGRvdWJsZSB4LCBkb3VibGUgeSl7CglyZXR1cm4gMTsvLzwtLSDQvNC10YHRgtC+INC00LvRjyDQstCy0L7QtNCwINGE0L7RgNC80YPQu9GLINC90LDRhdC+0LbQtNC10L3QuNGPINC60L7QvtGA0LTQuNC90LDRgtGLIHouCn0KZG91YmxlIGRsKGRvdWJsZSB4LCBkb3VibGUgeSwgZG91YmxlIHopewoJcmV0dXJuIHNxcnQoeCp4K3kqeSt6KnopOy8v0JTQu9C40L3QsCDQstC10LrRgtC+0YDQsC4KfQpkb3VibGUgcmFzKGRvdWJsZSB4aSwgZG91YmxlIHhqLCBkb3VibGUgeWksIGRvdWJsZS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