#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t > 0) {
    int n, s, si, f = 0, cnt = 1;
    cin >> n;
    string str;
    cin >> str;
    if ((str[0] == '0' && str[n - 1] == '1') ||
        (str[0] == '1' && str[n - 1] == '0') ||
        (str[0] == '1' && str[n - 1] == '1'))
      cout << n * 2 << endl;
    else {
      for (int i = 0; str[i] != '\0'; i++) {
        if (str[i] == '1') {
          s = i;
          f = 1;
          break;
        }
      }
      for (int i = 0; str[i] != '\0'; i++) {
        if (str[i] == '1') {
          si = i + 1;
          f = 1;
        }
      }
      int mx = max((n - s), si);
      if (f == 1)
        cnt = 2 * mx;
      else
        cnt = n;
      cout << cnt << endl;
    }
    t--;
  }
  return 0;
}
