Dessert Preparation
Creating desserts can be seen as a craft, an art, or a science. In this task, we'll focus on the scientific approach.
A local coffee shop offers a variety of desserts, each made up of a slice of pie with filling, topped with a scoop of ice cream. There are n different ways to make the pie crust, m filling options, and k types of ice cream. However, not every crust pairs well with every filling, not every filling complements every ice cream, and not every ice cream suits every crust.
Your goal is to find out how many types of desserts can be created where all three components are compatible with each other.
Input
The first line contains three integers: n, m, and k (1 ≤ n, m, k ≤ 50).
The second line contains one integer p (0 ≤ p ≤ 200) — the number of incompatible crust and filling pairs. Each of the next p lines contains two integers a and b (1 ≤ a ≤ n, 1 ≤ b ≤ m) — indicating the crust type and filling that do not go together. Each incompatible pair is listed only once.
The following line contains one integer q (0 ≤ q ≤ 200) — the number of incompatible filling and ice cream pairs. Each of the next q lines contains two integers a and b (1 ≤ a ≤ m, 1 ≤ b ≤ k) — indicating the filling and ice cream type that do not pair well. Each incompatible pair is listed only once.
The next line contains one integer r (0 ≤ r ≤ 200) — the number of incompatible crust and ice cream pairs. Each of the next r lines contains two integers a and b (1 ≤ a ≤ n, 1 ≤ b ≤ k) — indicating the crust type and ice cream type that do not match. Each incompatible pair is listed only once.
Output
Print a single number — the total number of dessert types that can be made with all three ingredients being compatible with each other.