#!/usr/bin/env python3 # %% import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines # %% x1, y1, x2, y2, D = map(int, read().split()) # %% def range_sum(a, b): def f(x): return x * (x + 1) // 2 return f(b - 1) - f(a - 1) # %% def f_RU(x, y, D): if D < 0: return 0 if x == -1 or y == -1: return 0 if x < y: x, y = y, x if x >= D and y >= D: return range_sum(1, D + 2) if x >= D and y < D: return range_sum(D - y + 1, D + 2) if x + y > D: return (x + 1) * (D - x + 1) + range_sum(D - y + 1, x + 1) return (x + 1) * (y + 1) def f(x, y, D): if x < y: x, y = y, x if x >= 0 and y >= 0: return f_RU(x, y, D) if x < 0 and y < 0: return f_RU(-2 - x, -2 - y, D - 2) if x >= 0 and y < 0: return -f_RU(x, -2 - y, D - 1) # %% x = 0 x += f(x2, y2, D) x += f(x1 - 1, y1 - 1, D) x -= f(x1 - 1, y2, D) x -= f(x2, y1 - 1, D) print(x)