#include <bits/stdc++.h>
using namespace std;
const double pai = acos(-1);
const double eps = 1e-10;
const long long mod = 1e9 + 7;
const int MXN = 1e6 + 5;
void Main(int avg) {
  int n;
  string s;
  cin >> n >> s;
  int cc = 0, l = 1e5, r = -1;
  for (int i = 0; i < n; i++)
    if (s[i] == '1') cc++;
  for (int i = 0; i < n; i++)
    if (s[i] == '1') r = max(r, i);
  for (int i = n - 1; i >= 0; i--)
    if (s[i] == '1') l = min(l, i);
  if (cc == 0) {
    cout << n << '\n';
    return;
  }
  int ans = n + 1;
  ans = max((r + 1) * 2, ans);
  ans = max((n - 1 - l + 1) * 2, ans);
  cout << ans << '\n';
}
int main() {
  int cas;
  cin >> cas;
  for (int i = 1; i <= cas; i++) Main(i);
  return 0;
}
