Super Knight

Count squares on an N by M board from which a knight with offsets (a,b) has exactly k legal moves.

Medium4MathImplementationNo attempts yetTime limit2sMemory limit512 MB

Problem

Hyeonjeong plays a chess variant with its own rules. The board has NN rows and MM columns, and the super knight is the only piece she can use.

From the square it stands on, the super knight moves to a square offset by (+a,+b)(+a, +b), (+a,b)(+a, -b), (a,+b)(-a, +b), (a,b)(-a, -b), (+b,+a)(+b, +a), (+b,a)(+b, -a), (b,+a)(-b, +a), (b,a)(-b, -a). An ordinary chess knight is the case a=2a = 2 and b=1b = 1.

There are 8 candidate moves in total, but the knight cannot move to a destination that lies outside the board.

Given aa, bb, NN, MM, and kk, write a program that counts the squares of the board from which exactly kk moves are possible.

Input

The first line contains aa, bb, NN, MM, and kk, separated by spaces. (1a,b,N,M1091 \le a, b, N, M \le 10^9, aba \ne b, 2×max(a,b)<min(N,M)2 \times \max(a, b) < \min(N, M), 0k80 \le k \le 8)

Output

Print the number of squares from which exactly kk moves are possible.