#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    string s;
    cin >> s;
    int res = 0, flag = 1, a = -1, b = -1;
    for (int i = 0; i < s.length(); i++) {
      if (s[i] == '1' && flag) {
        flag = 0;
        a = i;
      }
      if (s[i] == '1') b = i;
    }
    if (a == -1) {
      cout << n << endl;
      continue;
    }
    if (b + 1 > s.length() - a) {
      cout << 2 * (b + 1) << endl;
    } else {
      cout << 2 * (s.length() - a) << endl;
    }
  }
  return 0;
}
