#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long tt, nn, mm, i, j, k, l, m, n, a, b, c, d;
  cin >> tt;
  while (tt--) {
    string a;
    cin >> nn;
    cin >> a;
    long long maxi = nn;
    for (i = 0; i < nn; i++) {
      if (a[i] == '1') {
        maxi = max(maxi, 2 * nn - 2 * i);
      }
      if (a[nn - i - 1] == '1') {
        maxi = max(maxi, 2 * nn - 2 * i);
      }
    }
    cout << maxi << "\n";
  }
  return 0;
}
