You are given two sequences and .
Two sequences and match iff and for every possible pair .
Output the number of subsequences of that match .
The first line contains two integers , (, ).
The second line contains integers ().
The third line contains integers ().
Output one integer: the answer.
10 5 1 5 5 4 1 4 3 3 4 2 3 4 3 2 1
20
4 2 2 2 2 2 2 2
6
Good Luck!