#include <bits/stdc++.h>
using namespace std;
const int N = (int)1e6 + 5;
int w;
inline void boost() {
  ios_base ::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
int main() {
  boost;
  int tt;
  cin >> tt;
  while (tt--) {
    int n;
    string s;
    cin >> n >> s;
    int mn = n;
    int mx = -1;
    for (int i = 0; i < n; ++i) {
      if (s[i] == '1') {
        mn = min(mn, i);
        mx = max(mx, i);
      }
    }
    if (mx >= 0) {
      cout << max(n, max((n - mn) * 2, (mx + 1) * 2)) << "\n";
    } else {
      cout << n << "\n";
    }
  }
  return 0;
}
