#include <bits/stdc++.h>
using namespace std;
void vprnt(vector<long long int> v) {
  cout << "\n"
       << "\n"
       << "vector size: " << v.size() << "  \nthe vector: ";
  for (int i = 0; i < v.size(); i++) {
    cout << v[i] << " ";
  }
  cout << "\n"
       << "\n";
}
void aprnt(long long int a[]) {
  cout << "\n"
       << "\n"
       << "size of the array: " << (sizeof(a) / sizeof(a[0]))
       << "\nthe array is: ";
  for (long long int i = 0; i < (sizeof(a) / sizeof(a[0])); i++) {
    cout << a[i] << " ";
  }
  cout << "\n"
       << "\n";
}
void solve() {
  long long int n, m = 0;
  cin >> n;
  string s;
  cin >> s;
  long long int a = 0, b = 0;
  bool what = false;
  for (long long int i = 0; i < n; i++) {
    if (s[i] == '1') {
      a = i;
      what = true;
      break;
    }
  }
  if (!what) {
    cout << n;
    return;
  }
  reverse(s.begin(), s.end());
  for (long long int i = 0; i < n; i++) {
    if (s[i] == '1') {
      b = i;
      break;
    }
  }
  a = n - a;
  b = n - b;
  m = max(a, b);
  m *= 2;
  cout << m;
  return;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int tc = 1;
  cin >> tc;
  while (tc--) {
    solve();
    cout << "\n";
  }
  return 0;
}
