#include using namespace std; using Int = long long; template inline void chmin(T1 &a,T2 b){if(a>b) a=b;} template inline void chmax(T1 &a,T2 b){if(ad) return; //cout<yy2){ ans+=(x-xx1+1 + a-xx1+1)*(yy2-yy1+1)/2; return; } if(x>xx2&&y<=yy2){ ans+=(y-yy1+1 + b-yy1+1)*(xx2-xx1+1)/2; return; } assert(xx2-a==yy2-b); ans+=(xx2-xx1)*(yy2-yy1); ans-=(xx2-a+1)*(xx2-a)/2; }; Int x1,y1,x2,y2,d; cin>>x1>>y1>>x2>>y2>>d; solve( x1, y1, x2, y2,d); //cout<