#include <bits/stdc++.h>
using namespace std;
int cnt;
int viz[3][2000];
int mat[3][2000];
int n;
int maxx = 0;
void dfs(int x, int y, int cnt) {
  if (x > 2 || x < 1 || y > n || y < 1 || viz[x][y]) return;
  maxx = max(maxx, cnt);
  viz[x][y] = 1;
  dfs(x, y + 1, cnt + 1);
  dfs(x, y - 1, cnt + 1);
  if (mat[x][y]) {
    dfs(x + 1, y, cnt + 1);
    dfs(x - 1, y, cnt + 1);
  }
}
int main() {
  int tc;
  scanf("%d", &tc);
  for (int index = 1; index <= tc; ++index) {
    scanf("%d", &n);
    for (int k = 1; k <= 1005; ++k) mat[1][k] = mat[2][k] = 0;
    for (int i = 1; i <= n; ++i) {
      scanf("%1d", &mat[1][i]);
      mat[2][i] = mat[1][i];
    }
    maxx = n;
    for (int i = 1; i <= n; ++i) {
      if (mat[1][i] == 1) maxx = max(maxx, 2 * i);
    }
    for (int i = n; i >= 1; --i) {
      if (mat[1][i] == 1) maxx = max(maxx, 2 * (n - i + 1));
    }
    printf("%d\n", maxx);
  }
  return 0;
}
