#include <bits/stdc++.h>
using namespace std;
long long __gcd(long long a, long long b) {
  if (b == 0) return a;
  return __gcd(b, a % b);
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long t;
  cin >> t;
  while (t--) {
    long long n, b = -1, e = -1;
    cin >> n;
    string s;
    cin >> s;
    for (long long i = 0; i < n; i++)
      if (s[i] == '1') {
        b = i;
        break;
      }
    for (long long i = n - 1; i >= 0; i--)
      if (s[i] == '1') {
        e = i;
        break;
      }
    if (b == -1)
      cout << n;
    else
      cout << 2 * max(b, max(e, max(n - 1 - b, n - 1 - e))) + 2;
    cout << "\n";
  }
  return 0;
}
