#include <bits/stdc++.h>
using namespace std;
template <typename T>
std::ostream &operator<<(std::ostream &out, vector<T> &v) {
  for (typename vector<T>::size_type i = 0; i < v.size(); ++i)
    out << v[i] << " ";
  out << "\n";
  return out;
}
template <typename T>
std::ostream &operator<<(std::ostream &out, vector<vector<T> > &v) {
  for (size_t i = 0; i < v.size(); ++i) {
    for (size_t j = 0; j < v[i].size(); ++j) {
      out << v[i][j] << " ";
    }
    out << "\n";
  }
  return out;
}
int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    string s;
    cin >> s;
    int visited_left = 0, visited_right = 0;
    for (int i = 0; i < n; ++i) {
      if (s[i] == '1') {
        visited_right += 2 * (n - i);
        break;
      }
    }
    for (int i = n - 1; i >= 0; --i) {
      if (s[i] == '1') {
        visited_left += 2 * (i + 1);
        break;
      }
    }
    if (visited_left + visited_right == 0) {
      cout << n << "\n";
    } else {
      cout << max(visited_left, visited_right) << "\n";
    }
  }
  return 0;
}
