#include <bits/stdc++.h>
using namespace std;
template <class T>
bool sin(T &a, T b) {
  return a > b ? (a = b, true) : false;
}
template <class T>
bool sax(T &a, T b) {
  return a < b ? (a = b, true) : false;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.precision(10);
  cout << fixed;
  ;
  int t;
  cin >> t;
  for (int i = 0; i < t; i++) {
    int n;
    string s;
    cin >> n >> s;
    int fi = -1, se = -1;
    for (int i = 0; i < n; i++) {
      if (s[i] == '1' and fi == -1) fi = i + 1;
      if (s[i] == '1') se = i + 1;
    }
    if (fi == -1 and se == -1) {
      cout << n << "\n";
      continue;
    }
    int ans;
    if (se + fi > n)
      ans = 2 * (se);
    else
      ans = 2 * (n - fi + 1);
    cout << ans << "\n";
  }
  return 0;
}
