#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int t;
  scanf("%lld", &t);
  while (t--) {
    long long int n;
    scanf("%lld", &n);
    char a[n];
    scanf("%s", a);
    long long int index1 = -1;
    long long int index2 = -1;
    long long int ans1;
    long long int ans2;
    for (long long int i = 0; i < n; ++i) {
      if (a[i] == '1') index1 = i;
    }
    for (long long int i = n - 1; i >= 0; --i) {
      if (a[i] == '1') index2 = i;
    }
    if (index1 != -1) ans1 = index1 + 1 + max(index1 + 1, n - index1);
    if (index2 != -1) ans2 = n - index2 + max(index2 + 1, n - index2);
    long long int ans = max(ans1, ans2);
    if ((index1 == -1) && (index2 == -1))
      printf("%lld\n", n);
    else
      printf("%lld\n", ans);
  }
}
