K. Puzzle
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

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.

Input

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

Output one line containing one integer indicating the number of results Nerifish can get.

Example
Input
3 1 2 2
Output
21
Note

When the final expression is

  • "1-3*2*2" can get -11
  • "1-3*2-2" can get -7
  • "1-2*2-3" can get -6
  • "2-1-2*3" can get -5
  • "2-3-2-1" can get -4
  • "2-3-2*1" can get -3
  • "3-2-2-1" can get -2
  • "1*3-2-2" can get -1
  • "3-2-2+1" can get 0
  • "1*2*2-3" can get 1
  • "2*2-3+1" can get 2
  • "3*2-2-1" can get 3
  • "3*2-2*1" can get 4
  • "3*2-2+1" can get 5
  • "3+2*2-1" can get 6
  • "3*2+2-1" can get 7
  • "3*2+2*1" can get 8
  • "3*2+2+1" can get 9
  • "3*2*2-1" can get 11
  • "3*2*2*1" can get 12
  • "3*2*2+1" can get 13
There are a total of 21 different results here.

"-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").