#include <bits/stdc++.h>
using namespace std;
int probajdesno(string s, int n) {
  int i, br1 = 0, br = 0, bro = 0;
  for (i = 0; i < n; i++)
    if (s[i] == '1') br = i + 1;
  int index = br - 1;
  br = br * 2;
  for (i = 0; i < n; i++) {
    if (index == i) {
      br1 += 2;
      br1 += max(bro, n - index - 1);
      break;
    }
    if (s[i] == '0') {
      br1++;
      bro++;
    } else {
      br1 += 2;
      bro = 0;
    }
  }
  return max(br1, br);
}
void reverse(string &s) {
  string s1 = s;
  int i, j = 0;
  for (i = s1.size() - 1; i >= 0; i--) {
    s[j] = s1[i];
    j++;
  }
}
int probajlevo(string s, int n) {
  reverse(s);
  int i, br1 = 0, br = 0, bro = 0;
  for (i = 0; i < n; i++)
    if (s[i] == '1') br = i + 1;
  int index = br - 1;
  br = br * 2;
  for (i = 0; i < n; i++) {
    if (index == i) {
      br1 += 2;
      br1 += max(bro, n - index - 1);
      break;
    }
    if (s[i] == '0') {
      br1++;
      bro++;
    } else {
      br1 += 2;
      bro = 0;
    }
  }
  return max(br1, br);
}
int main() {
  int t, j;
  vector<int> v;
  cin >> t;
  for (j = 0; j < t; j++) {
    int n;
    cin >> n;
    int i;
    string s;
    cin >> s;
    v.push_back(max(probajlevo(s, n), probajdesno(s, n)));
  }
  for (int i = 0; i < t; i++) cout << v[i] << endl;
  return 0;
}
