#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int t;
  cin >> t;
  while (t--) {
    long long int n, i, count = 0, sum = 0, flag = 0, y, p, q, m;
    cin >> n;
    string a;
    cin >> a;
    for (i = 0; i < n; i++) {
      if (a[i] == '1')
        count++;
      else
        sum++;
    }
    if (count == n)
      cout << (2 * n) << endl;
    else if (sum == n)
      cout << n << endl;
    else if (a[0] == '1' || a[n - 1] == '1')
      cout << (2 * n) << endl;
    else {
      for (i = 0; i < n; i++) {
        if (a[i] == '1') y = i;
      }
      for (i = n - 1; i > 0; i--) {
        if (a[i] == '1') p = i;
      }
      q = (n - 1 - p);
      m = max(y, q);
      cout << (2 * m) + 2 << endl;
    }
  }
  return 0;
}
