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