#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    string a;
    cin >> a;
    int ans = 0;
    int maxindex = -1;
    int minindex = n;
    for (int i = 0; i < n; i++) {
      if (a[i] == '1') {
        maxindex = max(maxindex, i);
        minindex = min(minindex, i);
      }
    }
    cout << max(max((maxindex * 2 + 2), (n - minindex) * 2), n) << endl;
  }
}
