#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 * 2;
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 l = 0, r = n - 1;
    while (l <= n && s[l] == '0') l++;
    while (r >= 0 && s[r] == '0') r--;
    int ans;
    if (l > r)
      ans = n;
    else
      ans = max(r + 1, n - l) * 2;
    cout << ans << "\n";
  }
  return 0;
}
