#include <bits/stdc++.h>
using namespace std;
const long long N = 1e5 + 5, mod = 1e9 + 7, mod1 = 998242353, mod2 = 1e9 + 9,
                inf = 1e9 + 7;
const long long infll = 1e18 + 7;
long long q;
long long n, ans, x, y, a[N];
string s;
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> q;
  while (q--) {
    cin >> n >> s;
    x = n;
    y = -1;
    for (long long i = 0; i < n; i++) {
      if (s[i] == '1') {
        x = min(x, i);
        y = i;
      }
    }
    if (y == -1)
      cout << n << '\n';
    else
      cout << 2 * n - 2 * min(x, n - 1 - y) << '\n';
  }
}
