#define _USE_MATH_DEFINES #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair i_i; typedef pair ll_i; typedef pair d_i; typedef pair ll_ll; typedef pair d_d; struct edge { int u, v; ll w; }; ll MOD = 1000000007; ll _MOD = 1000000009; double EPS = 1e-10; int INF = INT_MAX / 2; ll f(ll x, ll y, ll d) { if (x > y) swap(x, y); if (x < 0) return 0; if (d <= x) return d * (d + 1) / 2; else if (d <= y) return x * (x + 1) / 2 + (x - d) * (x + 1); else if (d < x + y) { ll _d = x + y - d - 1; return (x + 1) * (y + 1) - _d * (_d + 1) / 2; } return (x + 1) * (y + 1); } ll g(ll x1, ll y1, ll x2, ll y2, ll d) { return f(x2, y2, d) - f(x2, y1 - 1, d) - f(x1 - 1, y2, d) + f(x1 - 1, y1 - 1, d); } ll solve(ll x1, ll y1, ll x2, ll y2, ll d) { if (x1 < 0 && x2 < 0) { x1 *= -1; x2 *= -1; swap(x1, x2); } if (y1 < 0 && y2 < 0) { y1 *= -1; y2 *= -1; swap(y1, y2); } if (y1 < 0) { swap(x1, y1); swap(x2, y2); } if (x1 >= 0 && y1 >= 0) return g(x1, y1, x2, y2, d); if (x1 < 0 && y1 >= 0) return g(0, y1, -x1, y2, d) + g(0, y1, x2, y2, d) - g(0, y1, 0, y2, d); if (x1 < 0 && y1 < 0) return g(0, 0, -x1, -y1, d) + g(0, 0, -x1, y2, d) + g(0, 0, x2, -y1, d) + g(0, 0, x2, y2, d) - g(0, 0, -x1, 0, d) - g(0, 0, 0, -y1, d) - g(0, 0, x2, 0, d) - g(0, 0, 0, y2, d) + 1; } int main() { ll x1, y1, x2, y2; cin >> x1 >> y1 >> x2 >> y2; ll d; cin >> d; cout << solve(x1, y1, x2, y2, d) << endl; }