The 24 puzzle is a classical arithmetical puzzle in which the objective is to find a way to manipulate four integers so that the end result is 24.
Nerifish is fond of this kind of puzzle, so he designed a similar puzzle for himself.
Nerifish has four Poker cards, the numbers on each card are $$$a,b,c,d(1\leq a,b,c,d\leq 13)$$$. He can arrange the cards in any order and connect them with plus, minus, and multiplication signs. Please note that brackets are NOT allowed to be used, the final expression should contain 4 integers and 3 operators.
Nerifish wants to know how many results he can get.
The first line of the input contains four integers $$$a,b,c$$$ and $$$d(1\leq a,b,c,d\leq 13)$$$, indicating the numbers on each card.
Output one line containing one integer indicating the number of results Nerifish can get.
3 1 2 2
21
When the final expression is
"-3*2*2-1" can get -13, but this expression is illegal(it does not meet the requirements of "3 operators").
"3+2+2+1" can get 8, but there is already an expression "3*2+2*1" which can also get 8.
"3*2*(2+1)" can get 18, but this expression is illegal(it does not meet the requirements of "no brackets").