#include <bits/stdc++.h>
const long long INF = 1e18;
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t;
  cin >> t;
  for (long long j = 0; j < t; j++) {
    long long n;
    cin >> n;
    string s;
    cin >> s;
    long long i1 = -1;
    for (long long i = n - 1; i >= 0; i--) {
      if (s[i] == '1') {
        i1 = i;
        break;
      }
    }
    if (i1 == -1) {
      cout << n << endl;
      continue;
    }
    reverse(s.begin(), s.end());
    long long i2 = 0;
    for (long long i = n - 1; i >= 0; i--) {
      if (s[i] == '1') {
        i2 = i;
        break;
      }
    }
    cout << max((i1 + 2 + max(n - 1 - i1, i1)), (i2 + 2 + max(n - 1 - i2, i2)))
         << endl;
  }
  return 0;
}
