#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  int t, n;
  cin >> t;
  while (t--) {
    cin >> n >> s;
    int f = 0, l = n - 1;
    while (f < n && s[f] != '1') f++;
    while (l >= 0 && s[l] != '1') l--;
    int ans = n;
    if (f < n && s[f] == '1') {
      ans = max(ans, 2 * (f + 1));
      ans = max(ans, 2 * (n - f));
    }
    if (l >= 0 && s[l] == '1') {
      ans = max(ans, 2 * (n - l));
      ans = max(ans, 2 * (l + 1));
    }
    cout << ans << endl;
  }
}
