#include <bits/stdc++.h>
using namespace std;
long long n, m, o, p, x, y, z;
vector<long long> a, b, c, d;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t;
  cin >> t;
  while (t--) {
    cin >> n;
    string s;
    cin >> s;
    int leftFirst = -1;
    int rightFirst = -1;
    for (long long i = 0; i < n; i++)
      if (s[i] == '1') {
        leftFirst = i;
        break;
      }
    for (long long i = 0; i < n; i++)
      if (s[i] == '1') {
        rightFirst = i;
      }
    if (leftFirst == -1) {
      cout << n << endl;
      continue;
    }
    if (rightFirst >= n - leftFirst) {
      cout << 2 * (rightFirst + 1) << endl;
    } else
      cout << 2 * (n - leftFirst) << endl;
  }
  return 0;
}
