#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    string s;
    cin >> s;
    int ind = -1;
    for (int i = 0; i < s.size(); i++) {
      if (s[i] == '1') {
        ind = i;
      }
    }
    int ans = ind + 1;
    for (int i = s.size() - 1; i >= 0; i--) {
      if (s[i] == '1') {
        ind = i;
      }
    }
    if (ind == -1) {
      cout << n << endl;
    } else {
      ans = max(ans, n - ind);
      cout << 2 * ans << endl;
    }
  }
  return 0;
}
