#include <bits/stdc++.h>
using namespace std;
int main() {
  int T, n;
  cin >> T;
  while (T--) {
    scanf("%d", &n);
    int x;
    int ans = n;
    for (int i = 1; i <= n; i++) {
      scanf("%1d", &x);
      if (x == 1) {
        ans = max(ans, max(n + 1, max(i * 2, (n - i + 1) * 2)));
      }
    }
    printf("%d\n", ans);
  }
  return 0;
}
