#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n, i, j, k, flag = 0, cnt = 0;
    cin >> n;
    string s;
    cin >> s;
    int x = 1;
    for (i = 0; i < s.size(); i++) {
      if (s[i] == '1' && !flag) {
        k = i;
        flag = 1;
      }
      if ((x == 1 && s[i] == '1') || (x == 0 && s[i] == '0')) {
        x = x % 2;
        cnt += 2;
      } else
        cnt++;
    }
    if (flag == 0) {
      cout << n << "\n";
      continue;
    }
    reverse(s.begin(), s.end());
    for (i = 0; i < s.size(); i++) {
      if (s[i] == '1') {
        j = i;
        break;
      }
    }
    int y = max(2 * (n - j), 2 * (j + 1));
    x = max(2 * (n - k), 2 * (k + 1));
    int l = max(x, y);
    cout << max(cnt, l) << "\n";
  }
}
