#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  for (int i = 0; i < t; ++i) {
    int n;
    cin >> n;
    string stairs;
    cin >> stairs;
    int left = -1, right = -1;
    for (int j = 0; j < n; ++j) {
      if (stairs[j] == '1') {
        if (left == -1) {
          left = j;
        }
        right = j;
      }
    }
    if (left == -1 && right == -1) {
      cout << n;
    } else if (left == -1 || right == -1) {
      if (left == -1) {
        cout << 2 * max(n - right, right + 1);
      } else {
        cout << 2 * max(n - left, left + 1);
      }
    } else {
      cout << 2 * max(max(left + 1, n - left), max(right + 1, n - right));
    }
    cout << endl;
  }
  return 0;
}
