#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    char a[n];
    int maxq = 0;
    int ans = 0;
    int t = 1;
    int beginq, endq;
    int countq = 0;
    for (int i = 0; i < n; i++) {
      cin >> a[i];
      if (a[i] == '1' && t) {
        beginq = i;
        t = 0;
      }
      if (a[i] == '1') {
        endq = i;
        countq++;
      }
    }
    if (n - endq - 1 > beginq) {
      ans = countq + n;
    } else {
      ans = (endq + 1) * 2;
    }
    if (maxq < ans) maxq = ans;
    if (t == 1) maxq = n;
    reverse(a, a + n);
    ans = 0;
    t = 1;
    countq = 0;
    for (int i = 0; i < n; i++) {
      if (a[i] == '1' && t) {
        beginq = i;
        t = 0;
      }
      if (a[i] == '1') {
        endq = i;
        countq++;
      }
    }
    if (n - endq - 1 > beginq) {
      ans = countq + n;
    } else {
      ans = (endq + 1) * 2;
    }
    if (ans > maxq) maxq = ans;
    if (t == 1) maxq = n;
    cout << maxq << endl;
  }
}
