#include <bits/stdc++.h>
using namespace std;
long long mod = 1e9 + 7;
long long n, i, j, ar[100005];
int main() {
  long long t;
  scanf("%lld", &t);
  while (t--) {
    scanf("%lld", &n);
    string s;
    cin >> s;
    long long f = 0;
    for (long long i = 0; i < s.length() / 2 + 1; i++) {
      if (s[i] == '1' || s[n - i - 1] == '1') {
        cout << (2 * (s.length() - i));
        printf("\n");
        f = 1;
        break;
      }
    }
    if (!f) cout << s.length() << "\n";
  }
}
