Problem Statement  
You have beads of several different colors that are to be placed on a string, with the requirement that for any group of three adjacent beads, all three must have different colors. You are given a int[] beads indicating how many of each color bead you have. The ith element of beads is the number of beads of color i, where each i represents a distinct color. You are to return a long representing the number of ways they can be placed on the string, meeting the given requirement.  
Definition  
 
Notes  
  The resulting arrangement of beads is linear, not circular. (Thus, the first bead on the string, and the last, are not adjacent.)  
Constraints  
  beads will contain between 3 and 5 elements, inclusive.  
  Each element of beads will be between 1 and 10, inclusive.  
  The total number of beads will not exceed 35.  
Examples  
0)  
 
1)  
 
2)  
 
3)  
 
4)  
