#include <bits/stdc++.h>
using namespace std;
void PLAY() {
  cout << fixed << setprecision(10);
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    string x;
    cin >> x;
    long long a = 0, b = 0;
    for (int i = 0, j = n - 1; i < n; i++, j--) {
      if (x[i] == '1') a = i + 1;
      if (x[j] == '1') b = j + 1;
    }
    if (!a) {
      cout << n << endl;
    } else {
      cout << 2 * (max(a, n - b + 1)) << endl;
    }
  }
  return 0;
}
