Triplets#5894

Triplets

1 second
64 megabytes
Very easy

Given three ranges of integers , , and , determine the total number of ordered triples of integers (x, y, z) that satisfy the following conditions:

  • x \ne y

  • x \ne z

  • y \ne z

  • a \le x \le A

  • b \le y \le B

  • c \le z \le C

Input

The first line of the input contains the integer . The second line contains integers separated by spaces, representing the sequence (a, A, b, B, c, C), where a \le A, b \le B, c \le C, and -10^3 \le a, b, c, A, B, C \le 10^3.

Output

Output a single line containing the answer to the problem.

Examples

Example 1

Loading
Loading