#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    string a;
    cin >> a;
    long long ans = n;
    long long first = -1, last = -1;
    for (long long i = 0; i < n; i++) {
      if (a[i] == '1') {
        first = i;
        break;
      }
    }
    for (long long i = n - 1; i >= 0; i--) {
      if (a[i] == '1') {
        last = i;
        break;
      }
    }
    if (first == -1) {
      cout << ans << endl;
      continue;
    }
    if (first == last) {
      cout << max(n + 1, 2 * max(last + 1, n - last)) << endl;
      continue;
    }
    ans = max(ans, 2 * (last + 1));
    ans = max(ans, 2 * (n - first));
    cout << ans << endl;
  }
  return 0;
}
