#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t = 1;
  cin >> t;
  while (t--) {
    long long int n;
    cin >> n;
    string str;
    cin >> str;
    long long int start = n;
    long long int end = 0;
    for (long long int i = 0; i < n; i++) {
      if (str[i] == '1') {
        start = min(start, i);
        end = max(end, i + 1);
      }
    }
    long long int ans = max(n - start, end);
    ans = 2 * ans;
    ans = max(ans, n);
    if (ans == 0) {
      cout << n << endl;
    } else {
      cout << ans << endl;
    }
  }
  return 0;
}
