#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    string s;
    cin >> s;
    if (s[0] == '1' || s[n - 1] == '1') {
      cout << n * 2 << '\n';
    } else {
      int ct = 0, lft = 0, rt = 0;
      for (int i = 0; i < n; ++i) {
        if (s[i] == '1') {
          lft = i;
          break;
        }
      }
      for (int i = n - 1; i >= 0; i--) {
        rt = (n - i) - 1;
        if (s[i] == '1' || (n - i) - 1 > lft) {
          break;
        }
      }
      lft != 0 ? cout << (n * 2) - (min(lft, rt) * 2) << '\n'
               : cout << n << '\n';
    }
  }
}
