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