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