#include <bits/stdc++.h>
using namespace std;
void rf() {}
void fast() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
}
void solve() {
  int n;
  cin >> n;
  string str;
  cin >> str;
  int p = str.find('1');
  int q = str.rfind('1');
  if (p == -1)
    cout << n << endl;
  else
    cout << max(n - p, q + 1) * 2 << endl;
}
int main() {
  fast();
  rf();
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
