#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  while (n--) {
    int m;
    cin >> m;
    string a;
    cin >> a;
    int x = 0;
    int y = m - 1;
    int sum = m * 2;
    bool falg = true;
    for (int i = 0; i < m / 2 + 1; i++) {
      if (a[x + i] == '1') {
        falg = false;
        cout << sum << endl;
        break;
      }
      if (a[y - i] == '1') {
        falg = false;
        cout << sum << endl;
        break;
      }
      sum -= 2;
    }
    if (falg) cout << m << endl;
  }
  return 0;
}
