#include <bits/stdc++.h>
using namespace std;
long long mod = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int tc;
  cin >> tc;
  while (tc--) {
    int n;
    cin >> n;
    string s;
    cin >> s;
    int last = -1, start = -1;
    for (long long i = 0; i < (n); i++) {
      if (s[i] == '1') {
        start = i;
        break;
      }
    }
    for (long long i = (n)-1; i >= 0; i--) {
      if (s[i] == '1') {
        last = i;
        break;
      }
    }
    if (last != -1) {
      int k = min(start, (n - last - 1));
      cout << (n - k) * 2 << endl;
    } else
      cout << n << endl;
  }
}
