#include <bits/stdc++.h>
using namespace std;
const int maxn = 4000 + 50;
const int maxm = 2000000 + 1000;
const int maxt = 3000000 + 100;
const int maxk = 10 + 3;
const long long unit = 1LL;
const int INF = 0x3f3f3f3f;
const long long Inf = 0x3f3f3f3f3f3f3f3fLL;
const double eps = 1e-3;
const double inf = 1e15;
const double pi = acos(-1.0);
const long long mod = 998244353LL, gg = 3LL, inv2 = 499122177LL;
inline long long read() {
  long long x = 0;
  bool t = false;
  char ch = getchar();
  while ((ch < '0' || ch > '9') && ch != '-') ch = getchar();
  if (ch == '-') t = true, ch = getchar();
  while (ch <= '9' && ch >= '0') x = x * 10 + ch - 48, ch = getchar();
  return t ? -x : x;
}
int n;
char str[maxn];
int main() {
  int T;
  T = read();
  while (T--) {
    n = read();
    scanf("%s", str + 1);
    int i = 1, j = n;
    int t = n;
    while (t--) {
      if (str[i] == '1' || str[j] == '1') break;
      ++i, --j;
    }
    if (i == n + 1 && j == 0) {
      printf("%d\n", n);
      continue;
    }
    int ans = 2 * j;
    printf("%d\n", ans);
  }
  return 0;
}
