#include <bits/stdc++.h>
using namespace std;
int main() {
  long long t, n;
  cin >> t;
  while (t--) {
    string a;
    cin >> n >> a;
    long long s = 0, q = -1, v = -1;
    for (int i = 0; i < n; i++) {
      if (q == -1 && a[i] == '1') q = i;
      if (a[i] == '0')
        s = s + 1;
      else {
        s = s + 2;
        v = i;
      }
    }
    long long g = 0;
    if (v > -1 && q > -1) g = max(2 * (v + 1), 2 * ((n - 1 - q) + 1));
    cout << max(g, s) << "\n";
  }
}
