#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(NULL);
  cin.tie(NULL), cout.tie(NULL);
  int T;
  int n;
  int sum;
  int pos1, pos2;
  string s;
  cin >> T;
  while (T--) {
    cin >> n;
    cin >> s;
    pos1 = n;
    pos2 = 0;
    for (int i = 0; i < n; i++) {
      if (s[i] == '1') {
        pos1 = i;
        break;
      }
    }
    for (int i = n - 1; i >= 0; i--) {
      if (s[i] == '1') {
        pos2 = i + 1;
        break;
      }
    }
    pos1 = n - pos1;
    int t = max(2 * pos1, 2 * pos2);
    cout << max(t, n) << endl;
  }
  return 0;
}
