#include <bits/stdc++.h>
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
const long long mod = 1e9 + 7;
long long sod(long long n) {
  long long sum = 0;
  while (n > 0) {
    sum += n % 10;
    n /= 10;
  }
  return sum;
}
long long dig(long long n) {
  long long cnt = 0;
  while (n > 0) {
    n /= 10;
    cnt++;
  }
  return cnt;
}
long long divs(long long n) {
  long long cnt = 0;
  for (long long x = 1; x * x <= n; x++) {
    if (n % x == 0) {
      cnt++;
      if (n / x != x) cnt++;
    }
  }
  return cnt;
}
long long isprime(long long n) {
  if (n < 2) return false;
  for (long long x = 2; x * x <= n; x++)
    if (n % x == 0) return false;
  return true;
}
long long power(long long x, unsigned long long y, long long p = mod) {
  long long res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
const long long inf = 1e18;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    string s;
    cin >> s;
    long long ans = 0;
    long long found = 0;
    for (long long x = 0; x < n; x++) {
      long long pos = x + 1;
      long long bck = n - x;
      long long cnt = 0;
      if (s[x] == '1') {
        cnt = 2 * pos;
        ans = max(ans, cnt);
        long long cnt2 = 2 * bck;
        ans = max(ans, cnt2);
      }
    }
    if (ans == 0) ans = n;
    cout << ans << '\n';
  }
  return 0;
}
