Problem D - David's Star

Given is David's star:
                          *
                         / \ 
                    *---*---*---* 
                     \ /     \ / 
                      *       *
                     / \     / \ 
                    *---*---*---* 
                         \ / 
                          *
and 12 distinct numbers. In how many ways, disregarding rotations and reflections, can you assign the numbers to the vertices (marked by asterisk in the figure above) such that the sum of the numbers along each of 6 straight lines passing through 4 vertices is the same?

Example: Given the following numbers:

3 17 15 18 11 22 12 23 21 7 9 13
we can have 4 different assignments:
        3                    3                    17                   18
        *                    *                    *                    *         
 7  23 / \ 15  12     17  9 / \ 18  13    21  13 / \ 11  12    22   9 / \ 3  23
  *---*---*---*        *---*---*---*        *---*---*---*        *---*---*---*   
   \ /     \ /          \ /     \ /          \ /     \ /          \ /     \ /    
 22 *       * 21      22 *       * 21      18 *       * 7       17 *       * 15    
   / \     / \          / \     / \          / \     / \          / \     / \    
  *---*---*---*        *---*---*---*        *---*---*---*        *---*---*---*   
 9  17 \ / 13  18     23  7 \ / 12  15     9   3 \ / 23  22    13  11 \ / 12  21   
        *                    *                    *                    *         
        11                   11                   15                   7
Although other assignments are possible they are rotations or reflections of one of the above.

Input is a sequence of lines, each line contains 12 distinct integers separated by whitespace.

For each input line output a single line with a single integer giving the number satisfying the conditions described above.

Sample input

1 2 3 4 5 6 7 8 9 10 11 12
3 17 15 18 11 22 12 23 21 7 9 13
11 3 13 14 6 1 9 7 20 12 8 19
4 5 8 12 11 6 2 9 7 3 13 1
1 2 3 4 5 6 7 8 9 10 11 13

Output for sample input

80
4
24
52
0