You are given two sequences and of length . Determine the number of different ways to permute the sequence such that it is lexicographically smaller than the sequence .
A sequence is strictly lexicographically smaller than a sequence , if there exists an index such that:
for all
A permutation of is considered different from another permutation of , if there exists an index such that . For example:
Input format
Output format
Print the remainder of the final answer when divided by
Only permutations and are lexicographically smaller than .