#include <bits/stdc++.h>
using namespace std;
long long int exp(long long int a, long long int b, long long int m);
int ans[100005];
void solve() {
  int n;
  cin >> n;
  char a[n];
  for (long long int i = 0; i < n; i++) cin >> a[i];
  int t = 0;
  for (long long int i = 0; i < n; i++) {
    if (a[i] == '1') {
      t = i + 1;
      break;
    }
    if (a[n - i - 1] == '1') {
      t = i + 1;
      break;
    }
  }
  if (t == 0)
    cout << n << endl;
  else
    cout << 2 * (n - t + 1) << endl;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  cin >> t;
  while (t--) solve();
  return 0;
}
long long int exp(long long int a, long long int b, long long int m) {
  if (b == 0) {
    return 1;
  }
  long long int temp = exp(a, b / 2, m);
  temp = (temp * temp) % m;
  if (b & 1) {
    return (temp * (a % m)) % m;
  }
  return temp;
}
