#include <bits/stdc++.h>
using namespace std;
int n, ans, l, r;
char a[1050];
int main() {
  int T;
  scanf("%d", &T);
  while (T--) {
    scanf("%d", &n);
    scanf("%s", a + 1);
    ans = n;
    l = r = 0;
    for (int i = 1; i <= n; i++)
      if (a[i] == '1') {
        l = i;
        break;
      }
    for (int i = n; i >= 1; i--)
      if (a[i] == '1') {
        r = i;
        break;
      }
    if (l > 0) {
      ans = max(ans, 2 * (n - l + 1));
    }
    if (r > 0) {
      ans = max(ans, 2 * r);
    }
    printf("%d\n", ans);
  }
  return 0;
}
