#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  int t, n, r, m;
  cin >> t;
  while (t--) {
    cin >> n >> s;
    if (s[0] == '1' or s[n - 1] == '1') {
      r = 2 * n;
      cout << r << endl;
    } else {
      m = -1;
      r = 0;
      for (int i = s.size() - 2; i >= 1; i--) {
        if (s[i] == '1') {
          r = i + 1;
          break;
        }
      }
      m = max(2 * r, m);
      if (m == 0) {
        cout << n << endl;
      } else {
        for (int i = 1; i < n - 1; i++) {
          if (s[i] == '1') {
            r = n - i;
            break;
          }
        }
        m = max(m, 2 * r);
        cout << m << endl;
      }
    }
  }
}
