Your toy in this challenge is a special abacus of 4 rows and 8 positions per row. There's one bead on the first row, 2 beads on the 2nd row, 3 beads on the 3rd row and 4 beads on the 4th row. Beads on a same row are glued together, which means that they can only be moved as a block.
Below is a valid configuration of the abacus:
---O----
------OO
-OOO----
---OOOO-
Of course, a block cannot be moved beyond the edges of the abacus. So there are 8 possible positions for the block on the first row and only 5 for the block on the last row.
Task
You'll be given a list of 8 non-negative integers representing the total number of beads in each column of the abacus. Your task is to output the number of configurations that lead to this result.
Examples
If the input is \$[4,3,2,1,0,0,0,0]\$, the only possible way is to put all blocks at the leftmost position:
O-------
OO------
OOO-----
OOOO----
________
43210000
If the input is \$[1,0,0,1,2,3,2,1]\$, there are 2 possible configurations:
O------- O-------
----OO-- -----OO-
-----OOO ---OOO--
---OOOO- ----OOOO
________ ________
10012321 10012321
If the input is \$[1,1,1,2,2,2,1,0]\$, there are 13 possible configurations. Below are just 4 of them:
O------- ---O---- ---O---- ------O-
-OO----- ----OO-- ----OO-- OO------
---OOO-- OOO----- ----OOO- ---OOO--
---OOOO- ---OOOO- OOOO---- --OOOO--
________ ________ ________ ________
11122210 11122210 11122210 11122210
Rules
- You can assume that the input is valid: all values are in \$[0\dots4]\$, their sum is \$10\$ and at least one configuration can be found.
- You can take the input list in any reasonable format (array, string of digits, etc.).
- Standard code-golf rules apply. The shortest code in bytes wins.
Test cases
[4,3,2,1,0,0,0,0] -> 1
[1,1,1,2,0,2,2,1] -> 1
[1,0,0,1,2,3,2,1] -> 2
[1,1,2,2,2,1,0,1] -> 3
[0,2,2,2,2,2,0,0] -> 4
[0,0,0,1,2,2,3,2] -> 5
[1,1,1,1,1,1,2,2] -> 6
[0,2,2,2,2,1,1,0] -> 8
[1,1,1,2,2,1,1,1] -> 10
[1,1,2,2,2,1,1,0] -> 12
[1,1,1,2,2,2,1,0] -> 13