Function to calculate total number of possible distributions which satisfies the given conditions
def validPermutations ( n , balls , usedBalls , i ) : NEW_LINE INDENT global box1 , box2 , fact NEW_LINE DEDENT