#include <bits/stdc++.h>
using namespace std;
int N;
string str;
int main(void) {
  int test_case;
  cin >> test_case;
  for (int t = 0; t < test_case; t++) {
    cin >> N >> str;
    int low = 0, high = N - 1, result = 0;
    while (str[low] == '0') low++;
    while (str[high] == '0') high--;
    result = max(N, max((high + 1) * 2, (N - low) * 2));
    cout << result << endl;
  }
}
