#include <bits/stdc++.h>
int max(int a, int b) {
  if (a > b)
    return a;
  else
    return b;
}
int main() {
  int t, j;
  scanf("%d", &t);
  for (j = 0; j < t; j++) {
    int n, i, first = 0, last = 0, flagf = 0, count = 0;
    scanf("%d", &n);
    char arr[n];
    scanf("%s", arr);
    for (i = 0; i < n; i++) {
      if (arr[i] == '1') {
        count++;
        last = i;
        if (!flagf) {
          first = i;
          flagf = 1;
        }
      }
    }
    if (arr[0] == '1' || arr[n - 1] == '1')
      printf("%d", 2 * n);
    else {
      if (!first && !last)
        printf("%d", 2 * count + (n - count));
      else {
        int k = 2 * (n - first);
        int l = 2 * (last + 1);
        int f = max(k, l);
        printf("%d", f);
      }
    }
    printf("\n");
  }
  return 0;
}
