#include <bits/stdc++.h>
using namespace std;
int const N = 3e5 + 10;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin.exceptions(cin.failbit);
  int t;
  cin >> t;
  while (t--) {
    int n;
    string s;
    cin >> n >> s;
    int ans = n;
    for (int i = 0; i < n; i++) {
      if (s[i] == '1') {
        ans = max(ans, 2 * (i + 1));
        ans = max(ans, 2 * (n - i));
      }
    }
    cout << ans << endl;
  }
}
