You are given two sequences A and B of length N. Determine the number of different ways to permute the sequence A such that it is lexicographically smaller than the sequence B.
A sequence (X1,X2,…,XK) is strictly lexicographically smaller than a sequence (Y1,Y2,…,YK), if there exists an index t (1≤t≤K) such that:
1. Xt<Yt
2. Xr=Yr for all 1≤r<t
A permutation X of A is considered different from another permutation Y of A, if there exists an index i (1≤i≤N) such that Xi≠Yi. For example:
Input format
Output format
Print the remainder of the final answer when divided by 109+7.
Only permutations (1,2,3) and (1,3,2) are lexicographically smaller than (2,1,3).