#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, t, i, j, h;
  cin >> t;
  for (i = 1; i <= t; i++) {
    cin >> n;
    int k, l, x, y, z;
    int c = 0, d = 0, sum1, sum2;
    char a[1001];
    cin >> a;
    k = strlen(a);
    for (j = 0; j < k; j++) {
      if (a[j] == '1') {
        c++;
        l = j;
        break;
      }
    }
    for (j = k - 1; j >= 0; j--) {
      if (a[j] == '1') {
        d++;
        y = j;
        break;
      }
    }
    z = (n - 1) - y;
    if (c == 0) {
      cout << n << endl;
    } else {
      x = n / 2;
      if (l <= x) {
        sum1 = (2 * (n - l));
      } else {
        sum1 = (2 * l);
      }
      if (z <= x) {
        sum2 = (2 * (n - z));
      } else {
        sum2 = (2 * z);
      }
      if (sum1 > sum2) {
        cout << sum1 << endl;
      } else {
        cout << sum2 << endl;
      }
    }
  }
}
