#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e9;
const long long MD = 1e9 + 7;
const double pi = acos(-1);
struct segmentTree {
  long long tl = 1, tr = (1ll << 21);
  segmentTree* left = nullptr;
  segmentTree* right = nullptr;
  long long val = 0;
  segmentTree(long long tl, long long tr) : tl(tl), tr(tr) {}
  segmentTree() = default;
  void createSons() {
    long long tm = (tl + tr) / 2;
    if (!left) {
      left = new segmentTree(tl, tm);
    }
    if (!right) {
      right = new segmentTree(tm + 1, tr);
    }
  }
  void update(long long pos, long long val) {
    if (tl == tr) {
      this->val = val;
      return;
    }
    long long tm = (tl + tr) / 2;
    createSons();
    if (pos <= tm) {
      left->update(pos, val);
    } else {
      right->update(pos, val);
    }
    this->val = (left->val) ^ (right->val);
  }
  long long get(long long l, long long r) {
    if (l > r) {
      return 0;
    }
    if (l == tl && tr == r) {
      return val;
    }
    long long tm = (tl + tr) / 2;
    createSons();
    return (left->get(l, min(r, tm))) ^ (right->get(max(tm + 1, l), r));
  }
};
ostream& operator<<(ostream& stream, const vector<long long>& v) {
  for (auto i : v) {
    stream << i << "\n";
  }
  return stream;
}
pair<long long, long long> operator+=(pair<long long, long long>& a,
                                      const pair<long long, long long>& b) {
  a.first += b.first;
  a.second += b.second;
  return a;
};
long long sqr(long long a) { return a * a % MD; }
long long binpow(long long a, long long b) {
  if (b == 0) {
    return 1;
  }
  if (b % 2 == 0) {
    return sqr(binpow(a, b / 2));
  }
  return a * binpow(a, b - 1) % MD;
}
long long fact(long long a) {
  long long res = 1;
  for (long long i = 2; i <= a; i++) {
    res *= i;
    res %= MD;
  }
  return res;
}
struct edge {
  long long u, v, c;
  bool operator<(const edge& other) const {
    if (c == other.c) {
      if (u == other.u) {
        return v < other.v;
      }
      return u < other.u;
    }
    return c < other.c;
  }
};
struct query {
  long long u, v, k, ind;
  bool operator<(const query& other) const {
    if (k == other.k) {
      if (u == other.u) {
        if (ind == other.ind) {
          return ind < other.ind;
        }
        return v < other.v;
      }
      return u < other.u;
    }
    return k < other.k;
  }
};
vector<long long> g[100006];
long long timer = 1;
long long subTreeSize[100006];
long long pred[100006];
long long tIn[100006];
long long tOut[100006];
void dfs(long long v) {
  tIn[v] = timer++;
  subTreeSize[v] = 1;
  for (auto i : g[v]) {
    if (!tIn[i]) {
      pred[i] = v;
      dfs(i);
      subTreeSize[v] += subTreeSize[i];
    }
  }
  tOut[v] = timer++;
}
bool isPred(long long a, long long b) {
  return (tIn[a] <= tIn[b] && tOut[b] <= tOut[a]);
}
long long chainNumOfVertex[100006], inChainPositionOfVertex[100006],
    chainSize[100006], chainRoot[100006], chainsCount;
vector<segmentTree> segmTrees;
struct HLD {
  void build(long long v, long long chainNum) {
    chainNumOfVertex[v] = chainNum;
    inChainPositionOfVertex[v] = chainSize[chainNum];
    chainSize[chainNum]++;
    if (chainSize[chainNum] == 1) {
      chainRoot[chainNum] = v;
    }
    long long maxChild = -1;
    for (auto i : g[v]) {
      if (i != pred[v] &&
          (maxChild == -1 || subTreeSize[i] > subTreeSize[maxChild])) {
        maxChild = i;
      }
    }
    if (maxChild != -1) {
      for (auto i : g[v]) {
        if (i == pred[v]) {
          continue;
        }
        if (i == maxChild) {
          build(i, chainNum);
        } else {
          segmTrees.push_back(segmentTree());
          build(i, ++chainsCount);
        }
      }
    }
  }
  long long get(long long a, long long b) {
    long long res = 0;
    for (long long i = 1; i <= 2; i++) {
      while (1) {
        if (isPred(chainRoot[chainNumOfVertex[a]], b)) {
          break;
        }
        segmTrees[chainNumOfVertex[a]].tl = 0;
        segmTrees[chainNumOfVertex[a]].tr = chainSize[chainNumOfVertex[a]];
        res ^=
            segmTrees[chainNumOfVertex[a]].get(0, inChainPositionOfVertex[a]);
        a = pred[chainRoot[chainNumOfVertex[a]]];
      }
      swap(a, b);
    }
    if (inChainPositionOfVertex[a] > inChainPositionOfVertex[b]) {
      swap(a, b);
    }
    segmTrees[chainNumOfVertex[a]].tl = 0;
    segmTrees[chainNumOfVertex[a]].tr = chainSize[chainNumOfVertex[a]];
    res ^= segmTrees[chainNumOfVertex[a]].get(inChainPositionOfVertex[a] + 1,
                                              inChainPositionOfVertex[b]);
    return res;
  }
  void update(long long a, long long val) {
    segmTrees[chainNumOfVertex[a]].tl = 0;
    segmTrees[chainNumOfVertex[a]].tr = chainSize[chainNumOfVertex[a]];
    segmTrees[chainNumOfVertex[a]].update(inChainPositionOfVertex[a], val);
  }
  void add(edge e) {
    if (pred[e.u] == e.v) {
      update(e.u, e.c);
    } else {
      update(e.v, e.c);
    }
  }
};
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    string st;
    cin >> st;
    st = '0' + st;
    long long ans = 0;
    for (long long i = 1; i < st.size(); i++) {
      if (st[i] == '1') {
        ans = max(2 * i, ans);
        ans = max((n - i + 1) * 2, ans);
      }
    }
    cout << max(ans, n) << "\n";
  }
}
