#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
struct Point {
  long long x;
  long long y;
};
int main() {
  int t;
  cin >> t;
  while (t) {
    t--;
    int n, res1 = 0, res2 = 0;
    cin >> n;
    string s;
    cin >> s;
    if (s[0] == '1' || s[s.size() - 1] == '1')
      cout << n * 2 << endl;
    else {
      int a = 0;
      for (int i = s.size() - 1; i >= 0; i--) {
        if (s[i] == '1') {
          a = i;
          break;
        }
      }
      res1 = (a + 1) * 2;
      reverse(s.begin(), s.end());
      int b = 0;
      for (int i = s.size() - 1; i >= 0; i--) {
        if (s[i] == '1') {
          b = i;
          break;
        }
      }
      res2 = (b + 1) * 2;
      if (a != 0 && b != 0)
        cout << max(res1, res2) << endl;
      else
        cout << n << endl;
    }
  }
}
