#include <bits/stdc++.h>
using namespace std;
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& v) {
  bool first = true;
  for (const auto& x : v) {
    if (!first) {
      os << " ";
    }
    first = false;
    os << x;
  }
  return os;
}
template <typename T>
istream& operator>>(istream& is, vector<T>& v) {
  for (auto& elem : v) {
    is >> elem;
  }
  return is;
}
long long pw(long long x, int n) {
  if (n == 1) {
    return x;
  }
  if (n % 2 == 0) {
    return pw((x * x) % 1000000007, n / 2);
  }
  return (pw(x, n - 1) * x) % 1000000007;
}
long long dv(long long a, long long b) {
  return (a * pw(b, 1000000007 - 2)) % 1000000007;
}
vector<long long> f;
void set_f(int n) {
  f.resize(n + 1);
  f[0] = 1;
  for (int i = 1; i <= n; i++) {
    f[i] = (f[i - 1] * i) % 1000000007;
  }
}
long long c_n_k(int n, int k) { return dv(dv(f[n], f[k]), f[n - k]); }
vector<vector<int> > g;
vector<long long> ans1;
vector<long long> ans2;
vector<int> cnt;
void dfs1(int x, int p) {
  int sum = 0;
  for (int y : g[x]) {
    if (y != p) {
      dfs1(y, x);
      sum += cnt[y];
    }
  }
  cnt[x] = sum + 1;
  ans1[x] = f[sum];
  for (int y : g[x]) {
    if (y != p) {
      ans1[x] = (ans1[x] * ans1[y]) % 1000000007;
      ans1[x] = dv(ans1[x], f[cnt[y]]);
    }
  }
}
void dfs2(int x, int p) {
  ans2[x] = ans1[x];
  for (int y : g[x]) {
    if (y != p) {
      int cnt_x = cnt[x];
      int cnt_y = cnt[y];
      long long ans_x = ans1[x];
      long long ans_y = ans1[y];
      ans1[x] = dv(ans1[x], ans1[y]);
      ans1[x] = dv(ans1[x], c_n_k(cnt[x] - 1, cnt[y]));
      cnt[x] -= cnt[y];
      cnt[y] += cnt[x];
      ans1[y] = (ans1[y] * ans1[x]) % 1000000007;
      ans1[y] = (ans1[y] * c_n_k(cnt[y] - 1, cnt[x])) % 1000000007;
      dfs2(y, x);
      cnt[x] = cnt_x;
      cnt[y] = cnt_y;
      ans1[x] = ans_x;
      ans1[y] = ans_y;
    }
  }
}
void solve() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  int l = -1;
  for (int i = 0; i < n; i++) {
    if (s[i] == '1') {
      l = i;
      break;
    }
  }
  int r = -1;
  for (int i = n - 1; i >= 0; i--) {
    if (s[i] == '1') {
      r = n - 1 - i;
      break;
    }
  }
  if (l == -1) {
    cout << n;
  } else {
    cout << 2 * n - 2 * min(l, r);
  }
}
int main() {
  ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
  if (1) {
    int tests;
    cin >> tests;
    while (tests--) {
      solve();
      cout << endl;
    }
  } else {
    solve();
    cout << endl;
  }
  return 0;
}
