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 A11, A12, ..., A1N1

Third line contains A21, A22, ..., A2N2

Fourth line contains A31, A32, ..., A3N3

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.114s 0.009s 13