Given 2n balls of k distinct colors. You will be given an integer array balls of size k where balls[i] is the number of balls of color i. 
All the balls will be shuffled uniformly at random, then we will distribute the first n balls to the first box and the remaining n balls to the other box (Please read the explanation of the second example carefully).
Please note that the two boxes are considered different. For example, if we have two balls of colors a and b, and two boxes [] and (), then the distribution [a] (b) is considered different than the distribution [b] (a) (Please read the explanation of the first example carefully).
We want to calculate the probability that the two boxes have the same number of distinct balls.
 
Example 1:
Input: balls = [1,1]
Output: 1.00000
Explanation: Only 2 ways to divide the balls equally:
- A ball of color 1 to box 1 and a ball of color 2 to box 2
- A ball of color 2 to box 1 and a ball of color 1 to box 2
In both ways, the number of distinct colors in each box is equal. The probability is 2/2 = 1

Example 2:
Input: balls = [2,1,1]
Output: 0.66667
Explanation: We have the set of balls [1, 1, 2, 3]
This set of balls will be shuffled randomly and we may have one of the 12 distinct shuffles with equale probability (i.e. 1/12):
[1,1 / 2,3], [1,1 / 3,2], [1,2 / 1,3], [1,2 / 3,1], [1,3 / 1,2], [1,3 / 2,1], [2,1 / 1,3], [2,1 / 3,1], [2,3 / 1,1], [3,1 / 1,2], [3,1 / 2,1], [3,2 / 1,1]
After that we add the first two balls to the first box and the second two balls to the second box.
We can see that 8 of these 12 possible random distributions have the same number of distinct colors of balls in each box.
Probability is 8/12 = 0.66667

Example 3:
Input: balls = [1,2,1,2]
Output: 0.60000
Explanation: The set of balls is [1, 2, 2, 3, 4, 4]. It is hard to display all the 180 possible random shuffles of this set but it is easy to check that 108 of them will have the same number of distinct colors in each box.
Probability = 108 / 180 = 0.6

Example 4:
Input: balls = [3,2,1]
Output: 0.30000
Explanation: The set of balls is [1, 1, 1, 2, 2, 3]. It is hard to display all the 60 possible random shuffles of this set but it is easy to check that 18 of them will have the same number of distinct colors in each box.
Probability = 18 / 60 = 0.3

Example 5:
Input: balls = [6,6,6,6,6,6]
Output: 0.90327

 
Constraints:

1 <= balls.length <= 8
1 <= balls[i] <= 6
sum(balls) is even.
Answers within 10^-5 of the actual value will be accepted as correct.

```python

USER_FILENAME = "<user_code>"
import sys, json, builtins
import math, heapq, bisect, itertools, functools, collections, statistics, fractions, decimal, operator, array, random, re, string, os, pathlib
try:
    import resource as _res
except Exception:
    _res = None
from collections import Counter, defaultdict, deque, OrderedDict
from functools import lru_cache, reduce
from itertools import accumulate, permutations, combinations, product
from math import gcd, ceil, floor, sqrt
from decimal import Decimal
try:
    from typing import *
except Exception:
    pass
try:
    sys.setrecursionlimit(1_000_000)
except Exception:
    pass
try:
    import site as _site
    try:
        _sys_sites = _site.getsitepackages() if hasattr(_site, "getsitepackages") else []
        for _p in _sys_sites:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
    try:
        _usp = _site.getusersitepackages()
        if isinstance(_usp, str):
            _usp = [_usp]
        for _p in _usp:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
except Exception:
    pass

def _disabled_input(*args, **kwargs):
    raise RuntimeError("input() is disabled in callable mode")
builtins.input = _disabled_input

ns = {"__name__": "__judge__"}  # prevent if __name__ == "__main__" blocks
for _k, _v in list(globals().items()):
    if not _k.startswith("_"):
        ns[_k] = _v
_CODE = 'class Solution:\n    def getProbability(self, balls: List[int]) -> float:\n        \n        \n        total = sum(balls)\n        def factorial(n):\n            if n == 0:\n                return 1\n            if n < 3:\n                return n\n            return n * factorial(n-1)\n        \n        self.match = 0\n        self.total = 0\n        def helper(p, left1, left2, cnt1, cnt2, per1, per2):\n            if left1 == 0 and left2 == 0:\n                self.total += per1 * per2\n                self.match += per1 * per2 * (cnt1 == cnt2)\n            elif left1 >= 0 and left2 >= 0:\n                for k in range(balls[p]+1):\n                    helper(p+1, left1 - k, left2 - balls[p] + k, cnt1 + (k > 0), cnt2 + (balls[p]-k > 0), per1 / factorial(k), per2/factorial(balls[p]-k))\n        \n        helper(0, total // 2, total //2, 0, 0, factorial(total//2), factorial(total//2))\n        # print(self.match)\n        # print(self.total)\n        return self.match/self.total\n                \n        \n        \n#         Track how many balls are left to fill each box as cnt1 and cnt2.\n# Count different colors in each box as col1 and col2; compare in the end.\n# The initial/maximum number of permutatons in each box is (n / 2)!\n# When selecting m balls of particular color, we reduce the number of permutations by m! if the color is the same, no difference, just like [1, 1 / 2, 3] and [1, 1 / 2, 3]. Even we change the position of the two 1, it makes no difference. However, the order of 2, and 3 matters.\n# When both cnt1 and cnt2 are zero, prm1 and prm2 are permutations in each box.\n# - Number of permutations = (n / 2)! / (m1! * m2! * ... * mk!).\n# - The total number of permutations with two boxes is prm1 * prm2.\n        \n    \n    \n#         total = sum(balls)\n#         k = len(balls)\n        \n#         def theSame(added):\n#             res = 0\n#             for i in range(k):\n#                 if added[i] == 0:\n#                     res -= 1\n#                 elif balls[i] == added[i]:\n#                     res += 1\n#             return res == 0\n        \n        \n#         def combination(this, pick):\n#             pick = min(this-pick, pick)\n#             res = 1\n#             i = this\n#             j = 1\n#             while i > pick:\n#                 res *= i\n#                 res /= j\n#                 i -= 1\n#                 j += 1\n#             return res\n            \n#         def helper(i, added, cur):\n            \n#             if cur == total // 2:\n               \n#                 if theSame(added):\n#                     res = 1\n#                     for i in range(k):\n#                         res *= combination(balls[i], added[i])\n#                     return res\n#                 return 0\n#             if i == k:\n#                 return 0\n#             if cur > total // 2:\n#                 return 0\n#             res = 0\n#             for t in range(balls[i]+1):\n#                 added[i] = t\n#                 res += helper(i+1, added, cur+t) \n#             added[i] = 0\n#             return res\n        \n#         added = [0] * k \n#         return helper(0, added, 0) / combination(total, total // 2)\n        \n        \n            \n                          \n                           \n                        \n                \n                    \n        \n                \n                \n        \n        \n        \n'
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

_target = None
_fn_name = 'getProbability'
if _fn_name:
    if "Solution" in ns:
        try:
            _obj = ns["Solution"]()
            if hasattr(_obj, _fn_name):
                _target = getattr(_obj, _fn_name)
        except Exception:
            _target = None
    if _target is None and _fn_name in ns and callable(ns[_fn_name]):
        _target = ns[_fn_name]
# Fallback: if there's exactly one user-defined function, use it
if _target is None:
    _cands = [v for k, v in ns.items() if callable(v) and getattr(v, "__module__", "") in ("__judge__", "__main__")]
    _user_funcs = [c for c in _cands if getattr(c, "__name__", "").startswith("_") is False]
    if len(_user_funcs) == 1:
        _target = _user_funcs[0]
if _target is None:
    raise RuntimeError(f"Could not resolve callable '{_fn_name}'")

_raw = sys.stdin.read().strip()
if _raw:
    _parsed = json.loads(_raw)
    if isinstance(_parsed, dict):
        _kwargs = _parsed.get("kwargs", {})
        _args = _parsed.get("args", [])
    else:
        _args, _kwargs = _parsed, {}
else:
    _args, _kwargs = [], {}
if not isinstance(_args, (list, tuple)):
    _args = [_args]
_res = _target(*_args, **_kwargs)
try:
    sys.stdout.write(repr(_res) + "\n")
except Exception:
    pass

```

Measured memory_bytes: 7238