#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  n = s.length();
  vector<int> v;
  if (s[0] == '1' || s[n - 1] == '1') {
    cout << 2 * n << "\n";
    return;
  }
  bool c = false;
  for (int i = 0; i < n; i++) {
    if (s[i] == '1') {
      v.push_back(i);
      c = true;
    }
  }
  if (!c) {
    cout << n << endl;
    return;
  }
  int dis = max(1 + v.back(), n - v.front());
  cout << 2 * dis << "\n";
  return;
}
int main() {
  long long t;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
