#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e7 + 5;
const int maxm = 2e5 + 5;
const int inf = 0x3f3f3f3f;
const long long mod = 1e9 + 7;
const double eps = 1e-9;
const double pi = acos(-1);
int m, n, w, k;
void init() {}
bool judge(int now) {}
long long quickpow(long long a, long long b) {
  long long ans = 1;
  while (b) {
    if (b & 1) ans = ans * a % mod;
    a = a * a % mod;
    b >>= 1;
  }
  return ans;
}
char c[1005];
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    scanf("%d", &n);
    scanf("%s", c);
    int first = -1, second = -1;
    for (int i = 0; i < n; i++)
      if (c[i] == '1') {
        first = i + 1;
        break;
      }
    for (int i = n - 1; i >= 0; i--)
      if (c[i] == '1') {
        second = i + 1;
        break;
      }
    if (first == -1)
      printf("%d\n", n);
    else
      printf("%d\n", 2 * max(second, n - first + 1));
  }
}
