#include <bits/stdc++.h>
using namespace std;
long long n, T;
char a[1005];
inline int read() {
  int x = 0, f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = 0;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = x * 10 + c - '0';
    c = getchar();
  }
  return f ? x : -x;
}
void write(int x) {
  if (x < 0) {
    putchar('-');
    x = -x;
  }
  if (x > 9) {
    write(x / 10);
  }
  putchar(x % 10 + '0');
}
int main() {
  cin >> T;
  while (T--) {
    n = read();
    cin >> (a + 1);
    long long fp = 0, sp = 0;
    for (int i = 1; i <= n; i++) {
      if (a[i] == '0') continue;
      fp = i;
      break;
    }
    for (int i = n; i >= 1; i--) {
      if (a[i] == '0') continue;
      sp = i;
      break;
    }
    long long ans = 0;
    if (sp == 0 && fp == 0) {
      cout << n << endl;
      continue;
    } else
      ans = max(max(sp, fp), max(n - sp + 1, n - fp + 1)) * 2;
    cout << ans << endl;
  }
  return 0;
}
