#include <bits/stdc++.h>
using namespace std;
const long long N = 1e5 + 1;
void trymax(long long& x, long long y) { x = max(x, y); }
void trymin(long long& x, long long y) { x = min(x, y); }
signed main() {
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    string s;
    cin >> s;
    long long ans = n;
    for (long long i = 0; i < n; i++) {
      if (s[i] == '1') {
        ans = max(ans, n + 1);
        ans = max(ans, 2 * (i + 1));
        ans = max(ans, (n - i) * 2);
      }
    }
    cout << ans << '\n';
  }
}
