#include <bits/stdc++.h>
using namespace std;
template <class T>
struct rge {
  T b, e;
};
template <class T>
rge<T> range(T i, T j) {
  return rge<T>{i, j};
}
struct debug {
  template <class T>
  debug& operator<<(const T&) {
    return *this;
  }
};
using ll = long long;
template <typename T>
void min_self(T& a, T b) {
  a = min(a, b);
}
template <typename T>
void max_self(T& a, T b) {
  a = max(a, b);
}
const int mod = 1e9 + 7;
const int pr[] = {29, 31};
inline int add(int a, int b) {
  a += b;
  while (a >= mod) a -= mod;
  while (a < 0) a += mod;
  return a;
}
inline void add_self(int& a, int b) { a = add(a, b); }
inline int mul(int a, int b) { return 1LL * a * b % mod; }
inline void mul_self(int& a, int b) { a = mul(a, b); }
inline int mpow(int a, int n) {
  int res = 1;
  while (n > 0) {
    if (n & 1) {
      res = mul(res, a);
    }
    a = mul(a, a);
    n >>= 1;
  }
  return res;
}
inline int divide(int a, int b) {
  assert(b != 0);
  return mul(a, mpow(b, mod - 2));
}
const int mxN = 3005;
int p[2][mxN], pinv[2][mxN];
vector<pair<int, int>> get_hash(string s) {
  int n = s.length();
  vector<pair<int, int>> pre(n + 1);
  for (int i = 0; i < n; i++) {
    pre[i + 1].first = add(mul(s[i] - '0' + 1, p[0][i]), pre[i].first);
    pre[i + 1].second = add(mul(s[i] - '0' + 1, p[1][i]), pre[i].second);
  }
  return pre;
}
pair<int, int> get(const vector<pair<int, int>>& pre, int i, int j) {
  pair<int, int> ans;
  ++j;
  ans.first = mul(pinv[0][i], add(pre[j].first, -pre[i].first));
  ans.second = mul(pinv[1][i], add(pre[j].second, -pre[i].second));
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  const vector<string> bad{"0011", "0101", "1110", "1111"};
  p[0][0] = pinv[0][0] = p[1][0] = pinv[1][0] = 1;
  for (int j = 0; j < 2; j++) {
    for (int i = 1; i < mxN; i++) {
      p[j][i] = mul(pr[j], p[j][i - 1]);
      pinv[j][i] = mpow(p[j][i], mod - 2);
    }
  }
  vector<pair<int, int>> bad_hash;
  for (string T : bad) {
    vector<pair<int, int>> pre = get_hash(T);
    bad_hash.push_back(get(pre, 0, 3));
  }
  int m;
  cin >> m;
  string s;
  int ans = 0;
  for (int i = 0; i < m; i++) {
    char c;
    cin >> c;
    s.push_back(c);
  }
  vector<pair<int, int>> pre = get_hash(s);
  set<pair<int, int>> seen;
  vector<vector<bool>> first(m, vector<bool>(m));
  for (int len = 1; len <= m; len++) {
    for (int i = 0; i <= m - len; i++) {
      pair<int, int> now = get(pre, i, i + len - 1);
      if (!seen.count(now)) {
        first[i][i + len - 1] = true;
      }
      seen.insert(now);
    }
    seen.clear();
  }
  for (int pos = 0; pos < m; pos++) {
    vector<int> dp(m + 1);
    dp[pos + 1] = 1;
    for (int i = pos; i >= 0; i--) {
      for (int end = i; end - i + 1 <= 4 && end <= pos; end++) {
        pair<int, int> now = get(pre, i, end);
        bool ok = true;
        for (pair<int, int> pp : bad_hash) {
          if (now == pp) {
            ok = false;
          }
        }
        if (!ok) {
          continue;
        }
        add_self(dp[i], dp[end + 1]);
      }
    }
    for (int start = 0; start <= pos; start++) {
      if (first[start][pos]) {
        add_self(ans, dp[start]);
      } else
        break;
    }
    cout << ans << "\n";
  }
}
