Team Building

Count pairs of K-cow teams, one from each farmer, such that after sorting both teams John's cow beats Paul's in every paired rank, modulo 1000000009.

Medium7SortingCombinatoricsDynamic programmingTwo pointersNo attempts yetTime limit2sMemory limit512 MB

Problem

Every year Farmer John brings his NN cows to the state fair to compete for best in show. His rival Farmer Paul brings his own MM cows. (1N10001 \le N \le 1000, 1M10001 \le M \le 1000)

Each of the N+MN+M cows at the fair receives an integer score. This year the final contest is decided by teams of KK cows. (1K101 \le K \le 10) John and Paul each pick KK of their own cows to form a team. The two teams are then paired off by score rank: the highest scoring cow on John's team is paired with the highest scoring cow on Paul's team, the second highest with the second highest, and the remaining pairs follow the same rule. John wins when his cow has the strictly higher score in every one of the KK pairs.

Count the team choices for which John wins. A choice is the pair of John's set of KK cows and Paul's set of KK cows, and two choices differ when either of the two sets differs. Print the count modulo 10000000091000000009.

Input

The first line contains NN, MM, and KK. The value of KK is no larger than NN and no larger than MM.

The second line contains the scores of John's NN cows.

The third line contains the scores of Paul's MM cows.

Every score is an integer between 11 and 100000100000.

Output

Print on one line the number of team choices for which John wins, modulo 10000000091000000009.