#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 1e5 + 10;
const int MAX_M = 1e5 + 10;
const long long INF = 1e18;
const long long MOD = 1e9 + 7;
void solve() {
  int n;
  scanf("%d", &n);
  int ans = n;
  string s;
  cin >> s;
  for (int i = 0; i < n; i++) {
    if (s[i] == '1') ans = max(ans, 2 * max(i + 1, n - i));
  }
  printf("%d\n", ans);
}
void multitest() {
  int t;
  scanf("%d", &t);
  for (int i = 0; i < t; i++) solve();
}
int main() { multitest(); }
