#include <iostream> #include <algorithm> using namespace std; long long w, h, s, g, x1, y1, x2, y2, sum1, sum2, y, tot, n; int main() { cin>>w>>h>>s>>g>>x1>>y1>>x2>>y2; y=(y2-y1)*(g+1); s=min(s, w-s); if(s<x1) { sum2=x2-x1; } else if(x2>s) { sum1=2*(s-x1); sum2=x2-s; } else { sum1=2*(x2-x1); } tot=w*h-y*(sum1+sum2); cout<<tot; }