#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, s = 0;
  cin >> t;
  for (int i = 0; i < t; i++) {
    s = 0;
    int n;
    cin >> n;
    char str[n];
    for (int k = 0; k < n; k++) cin >> str[k];
    if (str[0] == '1' || str[n - 1] == '1') {
      cout << n * 2 << endl;
    } else {
      for (int j = 1; j <= n / 2; j++) {
        if (str[j] == '1' || str[n - j - 1] == '1') {
          cout << (n - j) * 2 << endl;
          s = 1;
          break;
        }
      }
      if (s == 0) cout << n << endl;
    }
  }
  return 0;
}
