#include <bits/stdc++.h>
using namespace std;
const long long N = 2e5 + 5;
int32_t main() {
  ios_base::sync_with_stdio(false);
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    string second;
    cin >> n >> second;
    bool c = false;
    long long ans = 0;
    for (long long i = 0; i < n; ++i) {
      ans = max(ans, i + 1);
      if (second[i] == '1') {
        long long x = max(n - i, i + 1);
        ans = max(ans, i + 1 + x);
      }
    }
    reverse(second.begin(), second.end());
    for (long long i = 0; i < n; ++i) {
      ans = max(ans, i + 1);
      if (second[i] == '1') {
        long long x = max(n - i, i + 1);
        ans = max(ans, i + 1 + x);
      }
    }
    cout << ans << '\n';
  }
}
