Today Konstantin learned about convergence of series. For instance, series
As you may note, some simple looking series can converge to quite complicated numbers, like , , etc. Konstantin noted this and decided to study only special case of rational functions sums, that is
After some time, Konstantin decided to consider some very special case of rational functions when
Input Format
The first line of input contains single integer, . The next line contains integers , separated by space. The next line contains integers .
Constraints
- .
- are distinct.
Subtasks
Solutions that works correctly for will score at least of points.
Output Format
If answer is irreducible fraction , print , where is multiplicative inverse of modulo . It is guaranteed that .
Sample Input 0
2
0 1
1
Sample Output 0
1
Explanation 0
the sum is
Sample Input 1
3
0 1 2
1 3
Sample Output 1
750000007
Explanation 1
the sum is