#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    string s;
    int cnt = 0;
    cin >> n >> s;
    for (int i = 0; i < n; i++)
      if (s[i] == '1') cnt++;
    if (cnt == 0)
      cout << n << endl;
    else {
      int lstindex = -1;
      int fstindex = -1;
      for (int i = 0; i < n; i++) {
        if (s[i] == '1') {
          lstindex = i;
          if (fstindex == -1) fstindex = i;
        }
      }
      int ans = 0;
      ans = lstindex + 1 + max(n - lstindex, lstindex + 1);
      ans = max(ans, n - fstindex + max(n - fstindex, fstindex + 1));
      cout << ans << endl;
    }
  }
  return 0;
}
