#include <bits/stdc++.h>
using namespace std;
const long double PI = acos(-1.0);
void solve() {
  string s;
  long long n;
  cin >> n;
  cin >> s;
  long long cnt1 = 0;
  long long ans = 0;
  for (long long i = 0; i < (long long)s.size(); ++i) {
    if (s[i] == '1') {
      ans = max(ans, 2 * max(i + 1, n - i));
    }
  }
  ans = max(ans, n);
  cout << ans << '\n';
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
