#include <bits/stdc++.h>
using namespace std;
int t, n;
string s;
int w[2][1001];
int main() {
  cin >> t;
  for (int i = 1; i <= t; i++) {
    cin >> n;
    cin >> s;
    int k1 = -1, k2 = -1;
    for (int j = 0; j < s.size(); j++) {
      if (s[j] == '1' && k1 == -1)
        k1 = j;
      else if (s[j] == '1')
        k2 = j;
    }
    if (k1 == -1 && k2 == -1) {
      cout << n << "\n";
      continue;
    }
    if (k2 == -1) k2 = k1;
    k1++;
    k2++;
    cout << max(2 * (n - k1 + 1), 2 * k2) << "\n";
  }
  return 0;
}
