Bessie has two arrays of length $N$ ($1 \le N \le 500$). The $i$-th element of the first array is $a_i$ ($1 \le a_i \le 10^6$) and the $i$-th element of the second array is $b_i$ ($1 \le b_i \le 10^6$).
Bessie wants to split both arrays into non-empty subarrays such that the following is true.
Count how many ways she can split both arrays into non-empty subarrays while satisfying the constraints modulo $10^9+7$. Two ways are considered different if the number of subarrays are different or if some element belongs in a different subarray.
The first line contains $N$.
The next line contains $a_1,a_2,...,a_N$.
The next line contains $b_1,b_2,...,b_N$.
Output the number of ways she can split both arrays into non-empty subarrays while satisfying the constraints modulo $10^9+7$.