#include <bits/stdc++.h>
using namespace std;
void fast() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n, f = -1, l = 0;
    cin >> n;
    char ch;
    for (int i = 0; i < n; i++) {
      cin >> ch;
      if (ch == '1') {
        l = i + 1;
        if (f == -1) f = i + 1;
      }
    }
    if (f == -1)
      cout << n << endl;
    else
      cout << max(max(2 * l, 2 * (n - f + 1)), n) << endl;
  }
}
