Kyoya Ootori has a bag with n colored balls that are colored with k different colors. The colors are labeled from 1 to k. Balls of the same color are indistinguishable. He draws balls from the bag one by one until the bag is empty. He noticed that he drew the last ball of color i before drawing the last ball of color i + 1 for all i from 1 to k - 1. Now he wonders how many different ways this can happen. 


-----Input-----

The first line of input will have one integer k (1 ≤ k ≤ 1000) the number of colors.

Then, k lines will follow. The i-th line will contain c_{i}, the number of balls of the i-th color (1 ≤ c_{i} ≤ 1000).

The total number of balls doesn't exceed 1000.


-----Output-----

A single integer, the number of ways that Kyoya can draw the balls from the bag as described in the statement, modulo 1 000 000 007. 


-----Examples-----
Input
3
2
2
1

Output
3

Input
4
1
2
3
4

Output
1680



-----Note-----

In the first sample, we have 2 balls of color 1, 2 balls of color 2, and 1 ball of color 3. The three ways for Kyoya are: 

1 2 1 2 3

1 1 2 2 3

2 1 1 2 3

```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

ns = {"__name__": "__main__"}
for _k, _v in list(globals().items()):
    if not _k.startswith("_"):
        ns[_k] = _v
_CODE = "import math\n\ndef euclid_algorithm(a, b):\n    t1, t2 = abs(a), abs(b)\n    #saving equalities:\n    #t1 == x1 * a + y1 * b,\n    #t2 == x2 * a + y2 * b. \n    x1, y1, x2, y2 = int(math.copysign(1, a)), 0, 0, int(math.copysign(1, b))\n    if t1 < t2:\n        t1, t2 = t2, t1\n        x1, y1, x2, y2 = x2, y2, x1, y1\n\n    while t2 > 0:\n        if x1 * a + y1 * b != t1:\n            print('inshalla')\n        k = int(t1 // t2)\n        t1, t2 = t2, t1 % t2\n        #t1 - k * t2 == (x1 - k * x2) * a + (y1 - k * y2) * b\n        x1, y1, x2, y2 = x2, y2, x1 - k * x2, y1 - k * y2\n\n    return t1, x1, y1\n\ndef opposite_element(x, p):\n    gcd, k, l = euclid_algorithm(x, p)\n    if gcd != 1:\n        return -1\n    return k % p\n\ndef fact_mod(n, p):\n    prod = 1\n    for i in range(2,n+1):\n        prod *= i\n        prod %= p\n    return prod\n\nk = int(input())\nc = []\nfor i in range(k):\n    c.append(int(input()))\nprefix_sum = 0\np = 10 ** 9 + 7\ndenominator = 1\nfor c_i in c:\n    denominator *= fact_mod(c_i - 1, p)\n    denominator %= p\n    prefix_sum += c_i\n    denominator *= prefix_sum\n    denominator %= p\n\nnumenator = fact_mod(prefix_sum, p)\n\nprint(numenator * opposite_element(denominator, p) % p)\n"
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

```

Measured memory_bytes: 13535