#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    string str;
    cin >> str;
    int c1 = -1, c2 = -1;
    for (int i = 0; i < n; i++) {
      if (str[i] == '1') {
        c1 = i + 1;
        break;
      }
    }
    for (int i = n - 1; i >= 0; i--) {
      if (str[i] == '1') {
        c2 = i + 1;
        break;
      }
    }
    if (c1 == -1 && c2 == -1)
      cout << n << endl;
    else {
      c1 = n - c1 + 1;
      cout << 2 * max(c1, c2) << endl;
    }
  }
  return 0;
}
