Nikolay lives in a two-storied house. There are $n$ rooms on each floor, arranged in a row and numbered from one from left to right. So each room can be represented by the number of the floor and the number of the room on this floor (room number is an integer between $1$ and $n$). 

If Nikolay is currently in some room, he can move to any of the neighbouring rooms (if they exist). Rooms with numbers $i$ and $i+1$ on each floor are neighbouring, for all $1 \leq i \leq n - 1$. There may also be staircases that connect two rooms from different floors having the same numbers. If there is a staircase connecting the room $x$ on the first floor and the room $x$ on the second floor, then Nikolay can use it to move from one room to another.

 $\text{floor}$  The picture illustrates a house with $n = 4$. There is a staircase between the room $2$ on the first floor and the room $2$ on the second floor, and another staircase between the room $4$ on the first floor and the room $4$ on the second floor. The arrows denote possible directions in which Nikolay can move. The picture corresponds to the string "0101" in the input. 

 

Nikolay wants to move through some rooms in his house. To do this, he firstly chooses any room where he starts. Then Nikolay moves between rooms according to the aforementioned rules. Nikolay never visits the same room twice (he won't enter a room where he has already been). 

Calculate the maximum number of rooms Nikolay can visit during his tour, if:

  he can start in any room on any floor of his choice,  and he won't visit the same room twice. 


-----Input-----

The first line of the input contains one integer $t$ ($1 \le t \le 100$) — the number of test cases in the input. Then test cases follow. Each test case consists of two lines.

The first line contains one integer $n$ $(1 \le n \le 1\,000)$ — the number of rooms on each floor.

The second line contains one string consisting of $n$ characters, each character is either a '0' or a '1'. If the $i$-th character is a '1', then there is a staircase between the room $i$ on the first floor and the room $i$ on the second floor. If the $i$-th character is a '0', then there is no staircase between the room $i$ on the first floor and the room $i$ on the second floor.

In hacks it is allowed to use only one test case in the input, so $t = 1$ should be satisfied.


-----Output-----

For each test case print one integer — the maximum number of rooms Nikolay can visit during his tour, if he can start in any room on any floor, and he won't visit the same room twice.


-----Example-----
Input
4
5
00100
8
00000000
5
11111
3
110

Output
6
8
10
6



-----Note-----

In the first test case Nikolay may start in the first room of the first floor. Then he moves to the second room on the first floor, and then — to the third room on the first floor. Then he uses a staircase to get to the third room on the second floor. Then he goes to the fourth room on the second floor, and then — to the fifth room on the second floor. So, Nikolay visits $6$ rooms.

There are no staircases in the second test case, so Nikolay can only visit all rooms on the same floor (if he starts in the leftmost or in the rightmost room).

In the third test case it is possible to visit all rooms: first floor, first room $\rightarrow$ second floor, first room $\rightarrow$ second floor, second room $\rightarrow$ first floor, second room $\rightarrow$ first floor, third room $\rightarrow$ second floor, third room $\rightarrow$ second floor, fourth room $\rightarrow$ first floor, fourth room $\rightarrow$ first floor, fifth room $\rightarrow$ second floor, fifth room.

In the fourth test case it is also possible to visit all rooms: second floor, third room $\rightarrow$ second floor, second room $\rightarrow$ second floor, first room $\rightarrow$ first floor, first room $\rightarrow$ first floor, second room $\rightarrow$ first floor, third room.

Difficulty: interview

Starter code:

Solutions:
# Contest: Codeforces Round #592 (Div. 2) (https://codeforces.com/contest/1244)
# Problem: B: Rooms and Staircases (https://codeforces.com/contest/1244/problem/B)

def rint():
    return int(input())


def rints():
    return list(map(int, input().split()))


t = rint()
for _ in range(t):
    n = rint()
    s = input()
    mx = n
    for i in range(n):
        if s[i] == '0':
            continue
        mx = max(mx, 2 * max(i + 1, n - i))
    print(mx)


def main():
    import sys
    input = sys.stdin.readline
    
    def solve():
        n = int(input())
        s = input()
        l, r = -1, -1
        for i in range(n):
            if s[i] == '1':
                if l == -1:
                    l = i
                r = i
        
        if l == -1:
            print(n)
        else:
            print(2 * max(r + 1, n - l))
    
    for _ in range(int(input())):
        solve()
    
    return 0

main()


t = int(input())
for _ in range(t) :
    n = int(input())
    s = input()
    x = [i for i in range(n) if s[i] == '1']
    if len(x) == 0 :
        print(n)
    else :
        print( max( max(i+1+i+1, n-i+n-i) for i in x ) )


for _ in range(int(input())):
    n = int(input())
    s = input()
    if s == '0' * n:
        print(n)
    else:
        print(max(n - s.index('1'), s.rindex('1') + 1) * 2)


q = int(input())
for _ in range(q):
    n = int(input())
    s = input()
    min_pos = -1
    max_pos = -1
    for i in range(n):
        if s[i] == "1":
            max_pos = i
    for i in range(n)[::-1]:
        if s[i] == "1":
            min_pos = i
    if min_pos == -1:
        print(n)
    else:
        print(max(2*(max_pos + 1), 2*(n - min_pos)))

def solve():
    n = int(input())
    s = input()
    mn = mx = None
    for i in range(n):
        if s[i] == '0':
            continue
        if mn is None or mn > i:
            mn = i
        if mx is None or mx < i:
            mx = i
    ans = n
    if mn is not None:
        ans = max(ans, (n - mn) * 2)
    if mx is not None:
        ans = max(ans, (1 + mx) * 2)
    print(ans)


def main():
    t = int(input())
    for _ in range(t):
        solve()


main()


t = int(input())
for i in range(t):
    n = int(input())
    s = list(input())
    ans = n
    for i in range(n):
        if s[i] == "1":
            if i >= n // 2:
                ans = max(ans, 2 * (i + 1))
            else:
                ans = max(ans, (n - i) * 2)
    print(ans)

t=int(input())
for i in range(t):
    n=int(input())
    s=input()
    ma = n
    st=-1
    f=-1
    for j in range(n):
        if s[j]=='1':
            st=j
            break
    for j in range(n-1, -1, -1):
        if s[j]=='1':
            f = j
            break
    if f!=-1:
        ma=max(ma, (f+1)*2)
        ma=max(ma, (n-st)*2)
    print(ma)


t = int(input())

for _ in range(t):
	n = int(input())
	s = input()
	if not "1" in s:
		print(n)
		continue

	first = s.index("1")

	poss1 = 2 * (n-first)

	last = s[::-1].index("1")
	poss2 = 2 * (n-last)

	print(max(poss1, poss2))

for t in range(int(input())):
    n = int(input())
    st = input()
    ans = n
    if "1" in st:
        ans = max(ans, (n - st.find("1")) * 2, (st.rfind("1") + 1) * 2)
        ans = max(ans, n + st.count("1"))
    print(ans)

t = int(input())

for qwe in range(t):
	n = int(input())
	s = input()
	a = [i + 1 for i in range(len(s)) if s[i] == '1']
	if (a == []):
		print(n)
		continue
	
	mx = a[-1]
	mn = a[0]
	ans = max(mx, n - mn + 1) * 2
	print(ans)

for _ in range(int(input())):
    n = int(input())
    u = list(map(int, list(input())))
    if u[:] == [0] * n:
        print(n)
        continue
    a = -1; b = -1
    for i in range(n):
        if u[i] == 1:
            a = i
            break
    for i in range(n - 1, -1, -1):
        if u[i] == 1:
            b = i
            break
    print(max((n - a) * 2, (b + 1) * 2, n))


a = int(input())
for i in range(a):
    b = int(input())
    c = input()
    l = c.find('1')
    r = c.rfind('1')
    if l == -1:
        print(b)
    else:
        k1 = r + 1
        k2 = b - l
        print(max(k1, k2)*2)

for _ in range(int(input())):
    n = int(input())
    res = n
    cur = 0
    for i, c in enumerate(input()):
        if c == '1':
            x = i + 1
            y = n - x + 1
            res = max(res, 2 * x, n + 1, 2 * y)
            cur += 2
        else:
            cur += 1
    print(max(cur, res))

for i in range(int(input())):
    N = int(input())
    X = input()
    First, Last = 0, 0
    Rooms = 0
    if '1' in X:
        First, Last = X.index('1'), X[::-1].index('1')
        First = N - First
        Last = N - Last
        print(max(First, Last) * 2)
    else:
        print(N)
# Caption: Contest Time



t = int(input())
for i in range(t):
    n = int(input())
    s = input()

    l = s.find("1")
    r = n-1-s.rfind("1")

    if l < 0:
        print(n)
    else:
        mn = min(l, r)
        print((n-mn) * 2)


''' CODED WITH LOVE BY SATYAM KUMAR '''

from sys import stdin, stdout
import heapq
import cProfile, math
from collections import Counter, defaultdict, deque
from bisect import bisect_left, bisect, bisect_right
import itertools
from copy import deepcopy
from fractions import Fraction
import sys, threading
import operator as op
from functools import reduce
import sys

sys.setrecursionlimit(10 ** 6)  # max depth of recursion
threading.stack_size(2 ** 27)  # new thread will get stack of such size
fac_warm_up = False
printHeap = str()
memory_constrained = False
P = 10 ** 9 + 7


class MergeFind:
    def __init__(self, n):
        self.parent = list(range(n))
        self.size = [1] * n
        self.num_sets = n
        self.lista = [[_] for _ in range(n)]

    def find(self, a):
        to_update = []
        while a != self.parent[a]:
            to_update.append(a)
            a = self.parent[a]
        for b in to_update:
            self.parent[b] = a
        return self.parent[a]

    def merge(self, a, b):
        a = self.find(a)
        b = self.find(b)
        if a == b:
            return
        if self.size[a] < self.size[b]:
            a, b = b, a
        self.num_sets -= 1
        self.parent[b] = a
        self.size[a] += self.size[b]
        self.lista[a] += self.lista[b]

    def set_size(self, a):
        return self.size[self.find(a)]

    def __len__(self):
        return self.num_sets


def display(string_to_print):
    stdout.write(str(string_to_print) + "\n")


def prime_factors(n):  # n**0.5 complex
    factors = dict()
    for i in range(2, math.ceil(math.sqrt(n)) + 1):
        while n % i == 0:
            if i in factors:
                factors[i] += 1
            else:
                factors[i] = 1
            n = n // i
    if n > 2:
        factors[n] = 1
    return (factors)


def all_factors(n):
    return set(reduce(list.__add__,
                      ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))


def fibonacci_modP(n, MOD):
    if n < 2: return 1
    return (cached_fn(fibonacci_modP, (n + 1) // 2, MOD) * cached_fn(fibonacci_modP, n // 2, MOD) + cached_fn(
        fibonacci_modP, (n - 1) // 2, MOD) * cached_fn(fibonacci_modP, (n - 2) // 2, MOD)) % MOD


def factorial_modP_Wilson(n, p):
    if (p <= n):
        return 0
    res = (p - 1)
    for i in range(n + 1, p):
        res = (res * cached_fn(InverseEuler, i, p)) % p
    return res


def binary(n, digits=20):
    b = bin(n)[2:]
    b = '0' * (digits - len(b)) + b
    return b


def is_prime(n):
    """Returns True if n is prime."""
    if n < 4:
        return True
    if n % 2 == 0:
        return False
    if n % 3 == 0:
        return False
    i = 5
    w = 2
    while i * i <= n:
        if n % i == 0:
            return False
        i += w
        w = 6 - w
    return True


def generate_primes(n):
    prime = [True for i in range(n + 1)]
    p = 2
    while p * p <= n:
        if prime[p]:
            for i in range(p * 2, n + 1, p):
                prime[i] = False
        p += 1
    return prime


factorial_modP = []


def warm_up_fac(MOD):
    nonlocal factorial_modP, fac_warm_up
    if fac_warm_up: return
    factorial_modP = [1 for _ in range(fac_warm_up_size + 1)]
    for i in range(2, fac_warm_up_size):
        factorial_modP[i] = (factorial_modP[i - 1] * i) % MOD
    fac_warm_up = True


def InverseEuler(n, MOD):
    return pow(n, MOD - 2, MOD)


def nCr(n, r, MOD):
    nonlocal fac_warm_up, factorial_modP
    if not fac_warm_up:
        warm_up_fac(MOD)
        fac_warm_up = True
    return (factorial_modP[n] * (
            (pow(factorial_modP[r], MOD - 2, MOD) * pow(factorial_modP[n - r], MOD - 2, MOD)) % MOD)) % MOD


def get_int():
    return int(stdin.readline().strip())


def get_tuple():
    return list(map(int, stdin.readline().split()))


def get_list():
    return list(map(int, stdin.readline().split()))


memory = dict()


def clear_cache():
    nonlocal memory
    memory = dict()


def cached_fn(fn, *args):
    nonlocal memory
    if args in memory:
        return memory[args]
    else:
        result = fn(*args)
        memory[args] = result
        return result


def ncr(n, r):
    return math.factorial(n) / (math.factorial(n - r) * math.factorial(r))


def binary_search(i, li):
    fn = lambda x: li[x] - x // i
    x = -1
    b = len(li)
    while b >= 1:
        while b + x < len(li) and fn(b + x) > 0:  # Change this condition 2 to whatever you like
            x += b
        b = b // 2
    return x


# -------------------------------------------------------------- MAIN PROGRAM


TestCases = True
optimise_for_recursion = True  # Can not be used clubbed with TestCases WHen using recursive functions, use Python 3


def main():
    n = get_int()
    li = list(stdin.readline().strip())
    x = 10**10
    for i, ele in enumerate(li):
        if ele=='1':
            x = min(n-i-1, i, x)
    if x==10**10:
        print(n)
    else:
        print(2*(n-x))

# --------------------------------------------------------------------- END=


if TestCases:
    for i in range(get_int()):
        main()
else:
    main() if not optimise_for_recursion else threading.Thread(target=main).start()


for rpt in range(int(input())):
    n = int(input())
    layout = input()
    if layout == n * '0':
        print(n)
    else:
        left = 0
        while layout[left] == '0':
            left += 1
        right = n - 1
        while layout[right] == '0':
            right -= 1
        print(2 * max(n - left, right + 1))


def solve(a):
    left0 = 0
    right0 = 0
    if '1' not in a:
        return len(a)
    for i in a:
        if i == '0':
            left0 += 1
        else:
            break
    for i in a[::-1]:
        if i == '0':
            right0 += 1
        else:
            break
    return len(a) * 2 - min(left0, right0) * 2


def main():
    t = int(input())
    for _ in range(t):
        _ = int(input())
        a = input()
        print(solve(a))


main()


for _ in range(int(input())):
    n = int(input())
    s = input()
    fs = s.find('1')
    ans = (n-fs)*2
    sc = s.rfind('1')
    ans = max((sc+1)*2,ans)
    print(ans if fs != -1 else n)


t = int(input())
for i in range(t):
    n = int(input())
    string = input()
    total = 0
    for c in string:
        if c == '0':
            total += 1
        elif c == '1':
            total += 2
    l = len(string.lstrip('0'))
    r = len(string.rstrip('0'))
    total = max(total, 2 * l, 2 * r)
    print(total)


"""
NTC here
"""
from sys import stdin, setrecursionlimit
setrecursionlimit(10**7)


def iin(): return int(stdin.readline())
 
 
def lin(): return list(map(int, stdin.readline().split()))


# range = xrange
# input = raw_input
def main():
    for _ in range(iin()):
        n=iin()
        a=input()
        occ=[]
        ch=0
        for i in a:
            ch+=1
            if i=='1':
                occ.append(ch)
        ans=n
        if occ:
            mx,mn=occ[-1],occ[0]
            ans=max(ans,max(n-mx+1,mx)*2,max(n-mn+1,mn)*2)
        print(ans)

try:
    main()
except Exception as e: print(e)

t = int(input())

for i in range(t):
  n = int(input())
  s = input()
  mnj = s.find('1')
  mxj = s.rfind('1')
  if mnj == -1:
    print(n)
  else:
    print( max(n - mnj, mxj + 1) * 2 )


import sys
input = sys.stdin.readline

t=int(input())

for testcases in range(t):
    n=int(input())
    S=input().strip()

    ANS=n

    if "1" in S:
        t=S.index("1")
        ANS=max(ANS,(n-t)*2)

        #print(t)

        t=S[::-1].index("1")
        ANS=max(ANS,(n-t)*2)

        #print(t)

    print(ANS)