Correct Boards
You have a rectangular board of dimensions M×N, where each cell measures 1×1 and is colored either black or white. The board follows a standard chessboard pattern, meaning adjacent cells have different colors. We define the board as correct if it contains an equal number of black and white cells. A series of vertical and horizontal cuts have been made across this board, dividing it into several smaller boards. These cuts extend from one edge of the board to the opposite edge: horizontal cuts run from left to right, and vertical cuts run from bottom to top.
Your task is to write a program that calculates how many of these smaller boards are correct.
Input
The first line contains two natural numbers M and N (1 ≤ M, N ≤ 10^9), representing the vertical and horizontal dimensions of the board, respectively. The second line starts with an integer K, indicating the number of horizontal cuts, followed by the positions m_1, m_2, ..., m_K, which are the distances from the bottom edge to each cut line. These positions are integers listed in ascending order (1 ≤ m_1 < ... < m_K < M). The third line provides the number of vertical cuts L and the distances from the left edge to each cut line n_1, n_2, ..., n_L (1 ≤ n_1 < ... < n_L < N). The values K and L range from 0 to 10^5.
Output
Output a single number, which is the count of correct boards obtained after the cuts.