#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  for (int i = 0; i < t; i++) {
    bool f = false;
    int n;
    cin >> n;
    string x;
    cin >> x;
    for (int j = 0; j < x.size(); j++) {
      if (x[j] == '1') f = true;
    }
    auto it = x.find('1');
    auto it2 = x.rfind('1');
    if (f && it2 != it) {
      if (n - it >= it2 + 1)
        cout << 2 * (n - it) << endl;
      else if (n - it < it2 + 1)
        cout << 2 * (it2 + 1) << endl;
    } else if (f && it2 == it && n - it >= it2 + 1)
      cout << 2 * (n - it) << endl;
    else if (f && it2 == it && n - it < it2 + 1)
      cout << 2 * (it2 + 1) << endl;
    else
      cout << n << endl;
  }
}
