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