Triplets - 2#5975

Triplets - 2

1 second
64 megabytes
Medium

Given three integer ranges , , and , your task is to find the total number of ordered triples of integers (x, y, z) that satisfy the following conditions:

Input

The input consists of a single line containing six integers: , , , , , and , separated by spaces. These integers satisfy the conditions a \leq A, b \leq B, c \leq C, and -10^9 \leq a, b, c, A, B, C \leq 10^9.

Output

Output a single integer: the number of valid triples (x, y, z) that meet the criteria, modulo (10^9).

Examples

Example 1

Loading
Loading