#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t) {
    int n;
    cin >> n;
    string s;
    cin >> s;
    int p = 0;
    for (int i = 0; i < n - 1; i++)
      if (s[i] != s[i + 1]) p = 1;
    if (p == 0) {
      if (s[0] == '1')
        cout << n * 2 << "\n";
      else
        cout << n << "\n";
    } else {
      int x, y;
      for (int i = 0; i < n; i++)
        if (s[i] == '1') {
          x = i;
          break;
        }
      for (int i = n - 1; i >= 0; i--)
        if (s[i] == '1') {
          y = i;
          break;
        }
      int h = 0;
      h = max(x, n - 1 - y);
      h = max(h, n - 1 - x);
      h = max(h, y);
      cout << 2 * (h + 1) << "\n";
    }
    t--;
  }
  return 0;
}
