Chef is a big fan of soccer! He loves soccer so much that he even invented soccer for dogs! Here are the rules of soccer for dogs:
- N$N$ dogs (numbered 1$1$ through N$N$) stand in a line in such a way that for each valid i$i$, dogs i$i$ and i+1$i + 1$ are adjacent.
- Each dog has a skill level, which is either 1$1$ or 2$2$.
- At the beginning of the game, Chef passes a ball to dog 1$1$ (dog 1$1$ receives the ball).
- For each valid i$i$, if dog i$i$ has skill level s$s$, this dog can pass the ball to any dog with number j$j$ such that 1≤|i−j|≤s$1 \le |i-j| \le s$.
- Each dog (including dog 1$1$) may receive the ball at most once.
- Whenever a dog receives the ball, it must either pass it to another dog or finish the game by scoring a goal.
While the dogs were playing, Chef also created a game for developers. He defined the result of a game of soccer for dogs as the sequence of dogs which received the ball in the order in which they received it. The last dog in the sequence is the dog that decided to score a goal; if a dog never received the ball, it does not appear in the sequence. In the game for developers, you should find the number of possible results of soccer for dogs.
Find this number of possible results modulo 109+7$10^9 + 7$. Two results of soccer for dogs (sequences of dogs' numbers) are considered different if these sequences have different lengths or if there is a valid index i$i$ such that the i$i$-th dog in one sequence is different from the i$i$-th dog in the other sequence.

-----Input-----
- The first line of the input contains a single integer T$T$ denoting the number of test cases. The description of T$T$ test cases follows.
- The first line of each test case contains a single integer N$N$.
- The second line contains N$N$ space-separated integers A1,A2,…,AN$A_1, A_2, \ldots, A_N$ denoting the skill levels of the dogs.

-----Output-----
For each test case, print a single line containing one integer - the number of different results of soccer for dogs, modulo 109+7$10^9 + 7$.

-----Constraints-----
- 1≤T≤10$1 \le T \le 10$
- 1≤N≤105$1 \le N \le 10^5$
- 1≤Ai≤2$1 \le A_i \le 2$ for each valid i$i$

-----Subtasks-----
Subtask #1 (10 points): N≤10$N \le 10$
Subtask #2 (30 points): N≤103$N \le 10^3$
Subtask #3 (60 points): original constraints

-----Example Input-----
3
4
1 1 1 1
3
2 2 2
4
1 2 1 1

-----Example Output-----
4
5
6

-----Explanation-----
Example case 1: The following results are possible: 1$1$, [1,2]$[1, 2]$, [1,2,3]$[1, 2, 3]$, [1,2,3,4]$[1, 2, 3, 4]$.
Example case 2: The following results are possible: [1]$[1]$, [1,2]$[1, 2]$, [1,2,3]$[1, 2, 3]$, [1,3,2]$[1, 3, 2]$, [1,3]$[1, 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;\r\nfrom math import log2,sqrt;\r\nimport sys;\r\nsys.setrecursionlimit(pow(10,6))\r\nimport collections\r\nfrom collections import defaultdict\r\nfrom statistics import median\r\ninf = float("inf")\r\nmod=pow(10,9)+7\r\ndef give(l,n,index,visited):\r\n    if index<0 or index>=n:\r\n        return 0;\r\n    if visited[index]==1:\r\n        return 0;\r\n    visited[index]=1;\r\n    theta=1\r\n    # print("index is",index)\r\n    for i in graph[index]:\r\n        theta+=give(l,n,i,visited.copy())\r\n\r\n    return theta;\r\n\r\nfor i in range(int(input())):\r\n    n=int(input())\r\n    l=list(map(int,input().split()))\r\n    visited=defaultdict(int)\r\n    graph=defaultdict(set)\r\n    for i in range(len(l)):\r\n        if l[i]==1:\r\n            graph[i].add(i-1)\r\n            graph[i].add(i+1)\r\n        else:\r\n            graph[i].add(i-2)\r\n            graph[i].add(i-1)\r\n            graph[i].add(i+1)\r\n            graph[i].add(i+2)\r\n    theta=give(l,n,0,visited.copy())\r\n\r\n    print(theta)\r\n\r\n\r\n\r\n'
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

```

Measured memory_bytes: 14415