#include <bits/stdc++.h>
using namespace std;
int i, j, k;
int ans, res, temp, cnt;
int n, m;
char a[1010];
int main() {
  int ans1, ans2;
  int t;
  scanf("%d", &t);
  while (t--) {
    scanf("%d", &n);
    scanf("%s", a + 1);
    if (a[1] == '1' || a[n] == '1') {
      cout << 2 * n << endl;
      continue;
    }
    ans = n;
    for (i = 1; i <= n; i++) {
      if (a[i] == '1') ans = max(ans, max((n - i + 1) * 2, i * 2));
    }
    cout << ans << endl;
  }
  return 0;
}
