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