#include <bits/stdc++.h>
using namespace std;
int n;
int k = 0;
int maxx = 0;
int maxi = -1, maxi2 = -1;
int j;
int countt = 0;
int countt2 = 0;
string et;
string dom[2];
int e = 0;
int main() {
  cin >> n;
  for (int i = n; i > 0; i--) {
    cin >> k;
    cin >> et;
    dom[0] = et;
    dom[1] = et;
    if (et[0] == '1' || et[k - 1] == '1') {
      maxx = et.length() * 2;
    } else {
      while (j < k) {
        if (et[j] == '1') {
          maxi = j;
          if (maxi2 == -1) {
            maxi2 = j;
          }
        }
        j++;
      }
      if (maxi == -1) {
        countt = k;
      } else {
        countt = max((maxi + 1) * 2, (k - maxi2) * 2);
      }
      maxx = countt;
    }
    j = 0;
    e = 0;
    countt = 0;
    countt2 = 0;
    maxi = -1;
    maxi2 = -1;
    cout << maxx << endl;
  }
  cin >> n;
  return 0;
}
