#include <bits/stdc++.h>
using namespace std;
using Int = int64_t;
int main() {
  Int t;
  cin >> t;
  while (t--) {
    Int n;
    string led;
    cin >> n >> led;
    Int l = 9999999;
    Int r = -9999999;
    for (Int i = 0; i < led.size(); i++) {
      if (led[i] == '1') {
        l = min(l, i);
        r = max(r, i);
      }
    }
    if (l == 9999999 && r == -9999999) {
      cout << n << endl;
    } else {
      Int x = max(r, n - l - 1);
      cout << 2 * (x + 1) << '\n';
    }
  }
  return 0;
}
