#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int n;
    string s;
    cin >> n >> s;
    if (s[0] == '1' || s[n - 1] == '1')
      cout << 2 * n << "\n";
    else {
      int p = -1, q = -1;
      for (int i = 0; i < n; i++) {
        if (s[i] == '1') {
          p = i;
          break;
        }
      }
      if (p == -1) {
        cout << n << "\n";
        continue;
      }
      for (int i = n; i >= 0; i--) {
        if (s[i] == '1') {
          q = i;
          break;
        }
      }
      cout << max(2 * (n - p), (q + 1) * 2) << "\n";
    }
  }
  return 0;
}
