#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n, c = 0;
    cin >> n;
    string s;
    cin >> s;
    for (int i = 0; i < s.length(); i++)
      if (s[i] == '1') c++;
    int ans = n + c;
    for (int i = 0; i < s.length(); i++) {
      if (s[i] == '1') {
        int w = max(((i + 1) * 2), ((n - i) * 2));
        ans = max(w, ans);
      }
    }
    cout << ans << endl;
  }
  return 0;
}
