#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  int a[t];
  for (int y = 0; y < t; y++) {
    int n;
    cin >> n;
    string s;
    cin >> s;
    vector<int> v;
    for (int i = 0; i < n; i++) {
      if (s.at(i) == '1') v.push_back(i + 1);
    }
    if (v.empty())
      a[y] = n;
    else if (v.size() == 1) {
      a[y] = (max(n - v[0], v[0] - 1) + 1) * 2;
    } else {
      a[y] = (max(n - v[0], v[v.size() - 1] - 1) + 1) * 2;
    }
  }
  for (int i = 0; i < t; i++) cout << a[i] << endl;
}
