Math Contest

View as PDF

Submit solution


Points: 16
Time limit: 1.0s
Memory limit: 128M

Problem types

You are a teacher and you have 3 classes. First and the best class is college students' class, the second one is high school students' and the third one is middle school students'. Each student has a unique Skill Point. This point represents how good is this student at math.

You have to select a 3-student team consisting of exactly 1 university student, 1 high school student, and 1 middle school student for the upcoming math contest.

There is one more requirement. The middle school student of a team should have a lower skill point than the high school student and similarly, the high school student should have a lower skill point than the university student; so that none of the students is jealous.

What you need to do is to calculate how many different teams you can form. Two teams are considered different if there is at least one different member.

Input

The first line contains 3 integers \(\mathbf{O} \), \(\mathbf{L} \), \(\mathbf{U}\): The number of middle school, high school, and university students respectively.

The second line contains \(\mathbf{O}\) integers: Skill Point of each middle school student.

The third line contains \(\mathbf{L}\) integers: Skill Point of each high school student.

The fourth line contains \(\mathbf{U}\) integers: Skill Point of each university student.

Output

Print how many teams you can form in a single line.

Batch #1:
  • \(1 \leq \mathbf{O, L, U} \leq 100\)
  • \(1 \leq \) Skill Point \( \leq 100\)
Batch #2:
  • \(1 \leq \mathbf{O, L, U} \leq 10^5\)
  • \(1 \leq \) Skill Point \( \leq 10^5\)

Examples

Input:

4 4 4
1 2 3 4
1 2 3 4
1 2 3 4

Output:

4

Input:

3 4 5
1 2 3
3 4 5 6
7 8 9 10 11

Output:

55

Explanation

Input #1

Skill points of the teams that can be formed:

  • 1, 2, 3
  • 1, 2, 4
  • 1, 3, 4
  • 2, 3, 4