Rock-paper-scissors is a common game: rock beats scissors, scissors beats paper, and paper beats rock. If both players choose the same gesture, it is a draw. In the 8th episode of the second season of The Big Bang Theory, an upgraded version of rock-paper-scissors was introduced. This version adds two new gestures to the traditional game:
- Spock: One of the protagonists of Star Trek.
- Lizard: An antagonist from Star Trek.
The win-loss relationships for these five gestures are shown in Table 1, which lists the results for Player A vs. Player B.
| A\B | Scissors | Rock | Paper | Lizard | Spock |
|---|---|---|---|---|---|
| Scissors | Draw | Loss | Win | Win | Loss |
| Rock | Draw | Loss | Win | Loss | |
| Paper | Draw | Loss | Win | ||
| Lizard | Draw | Win | |||
| Spock | Draw |
Table 1 Win-loss relationships for the upgraded rock-paper-scissors
Now, Player A and Player B are playing this upgraded version. It is known that their gestures follow a periodic pattern, though the cycle lengths are not necessarily equal. For example: if Player A plays with a cycle of length $6$ ("Rock-Paper-Rock-Scissors-Lizard-Spock"), their sequence of gestures is "Rock-Paper-Rock-Scissors-Lizard-Spock-Rock-Paper-Rock-Scissors-Lizard-Spock-...". If Player B plays with a cycle of length $5$ ("Scissors-Rock-Paper-Spock-Lizard"), their sequence of gestures is "Scissors-Rock-Paper-Spock-Lizard-Scissors-Rock-Paper-Spock-Lizard-...".
Given that Player A and Player B play $N$ rounds in total, the winner of each round gets $1$ point, and the loser gets $0$ points. In the event of a draw, both players get $0$ points. Please calculate the final scores of both players after $N$ rounds.
Input
The first line contains three integers: $N, N_A, N_B$, representing the total number of rounds, the cycle length of Player A, and the cycle length of Player B, respectively. The numbers are separated by a space.
The second line contains $N_A$ integers representing the pattern of Player A, and the third line contains $N_B$ integers representing the pattern of Player B. Here, 0 represents "Scissors", 1 represents "Rock", 2 represents "Paper", 3 represents "Lizard", and 4 represents "Spock". The numbers are separated by a space.
Output
Output a single line containing two integers separated by a space, representing the scores of Player A and Player B, respectively.
Examples
Input 1
10 5 6 0 1 2 3 4 0 3 4 2 1 0
Output 1
6 2
Input 2
9 5 5 0 1 2 3 4 1 0 3 2 4
Output 2
4 4
Constraints
For $100\%$ of the data, $0 < N \leq 200, 0 < N_A \leq 200, 0 < N_B \leq 200$.