 Final
 Elimination
 Third qual
 Second qual
 First qual
 Warmup
Warmup round completed
Tasks
Show one task per page / all tasks on one page
Time limit  2 seconds 

Memory limit  256 megabytes 
To create the magic weapon Space Rangers need to use three details: green, red and blue.
Green, Red and Blue rangers want to know how many different ways they have to create the weapon. Each ranger has several details, Green Ranger has green details, Red Ranger has red details, Blue Ranger has blue details.
Each detail has its model number. To create the weapon rangers need to follow three rules:
 The first digit of the model number of the red detail must be equal to the last digit of the model number of the green detail.
 The last digit of the model number of the red detail must be equal to the first digit of the model number of the blue detail.
 Model numbers of all three details must be different.
Two ways to create the weapon are considered different if at least one ranger uses another detail, even if its model number is the same.
For each ranger you are given model numbers of their details. One ranger can have several details with the same model number.
Help rangers to find out how many different ways to create the magic weapon they have.
Input format 
The first line of input contains three integers: g, r and b — the number of details that Green Ranger, Red Ranger and Blue Ranger have, correspondingly (1 ≤ g, r, b ≤ 10^{5}). The following line contains g integers x_{i} — model numbers of the green details (0 ≤ x_{i} ≤ 10^{9}). The following line contains r integers y_{i} — model numbers of the red details (0 ≤ y_{i} ≤ 10^{9}). The following line contains b integers z_{i} — model numbers of the blue details (0 ≤ z_{i} ≤ 10^{9}). 

Output format 
Print one integer — the number of ways to create the magic weapon. 
Examples 
Input data
3 3 2 101 11 52 11 23 23 31 13
Output data
3 
