#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
const int MAXN = 1000;
int n;
char s[MAXN + 1];
int solve() {
  int ret = n;
  for (int i = (0); i < (n); ++i)
    if (s[i] == '1' || s[n - i - 1] == '1') ret = max(ret, 2 * (n - i));
  return ret;
}
void run() {
  scanf("%d", &n);
  scanf("%s", s);
  assert(strlen(s) == n);
  printf("%d\n", solve());
}
int main() {
  int ncase;
  scanf("%d", &ncase);
  for (int i = (1); i <= (ncase); ++i) run();
  return 0;
}
