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