A _latin square_ is defined as a 4 by 4 grid of numbers, where all of the numbers in each row and column are distinct, i.e. no two pairs of elements in each row and column are equal.
You're given a partially filled in latin square. Figure out how many valid latin squares can be formed by filling in the empty digits of the latin square.
The input consists of 4 lines, each consisting of 4 integers: the digits in the latin square. For each digit, if it has already been filled in, it will be represented with a digit from 1 to 4, and if it hasn't been filled in yet, it will be represented with a "0".
Output a single positive integer $n$: the number of ways to fill in the latin square as described above.
## Input
The input consists of 4 lines, each consisting of 4 integers: the digits in the latin square. For each digit, if it has already been filled in, it will be represented with a digit from 1 to 4, and if it hasn't been filled in yet, it will be represented with a "0".
## Output
Output a single positive integer $n$: the number of ways to fill in the latin square as described above.
[samples]
**Definitions**
Let $ L \in \{0,1,2,3,4\}^{4 \times 4} $ be a partial Latin square, where $ L_{i,j} \in \{1,2,3,4\} $ if filled, and $ L_{i,j} = 0 $ if empty.
**Constraints**
1. For each row $ i \in \{1,2,3,4\} $, all non-zero entries are distinct.
2. For each column $ j \in \{1,2,3,4\} $, all non-zero entries are distinct.
3. Any complete filling must result in a Latin square: each row and each column is a permutation of $ \{1,2,3,4\} $.
**Objective**
Count the number of completions $ L' \in \{1,2,3,4\}^{4 \times 4} $ such that:
- $ L'_{i,j} = L_{i,j} $ for all $ (i,j) $ where $ L_{i,j} \neq 0 $,
- Each row of $ L' $ is a permutation of $ \{1,2,3,4\} $,
- Each column of $ L' $ is a permutation of $ \{1,2,3,4\} $.