Problem A. Ascending arrays

Input file:Standard input   Time limit:1 sec
Output file:Standard output   Memory limit:256 Mb

Statement

There are three strictly increasing arrays of integers A1, A2, A3 with lengths N1, N2, N3.

Your program must find the count of triples of the same numbers simultaneously occurring in each of these arrays.

Input format

First line contains N1, N2, N3.

Second line contains A1 1, A1 2, ..., A1 N1

Third line contains A2 1, A2 2, ..., A2 N2

Fourth line contains A3 1, A3 2, ..., A3 N3

Output format

A single integer — count of triplets.

Constraints

1 ≤ N1, N2, N3 ≤ 105

0 ≤ Ai j ≤ 109

Sample tests

No. Standard input Standard output
1
5 4 3
2 3 4 5 7
1 2 3 4
2 3 4
3
2
5 4 3
2 3 4 5 7
1 2 4 7
1 3 5
0

0.107s 0.018s 15