#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = 1e9 + 7;
int m, s[3005], z[3005];
ll dp[3005];
inline int f(int i, int len) {
  if (len != 4) return 1;
  int x = s[i + 3] + 2 * s[i + 2] + 4 * s[i + 1] + 8 * s[i];
  if (x == 3 || x == 5 || x == 14 || x == 15) return 0;
  return 1;
}
int main() {
  scanf("%d", &m);
  for (int i = 0; i < m; ++i) scanf("%d", s + i);
  ll ans = 0;
  dp[0] = 1;
  for (int n = 1; n <= m; ++n) {
    int lo = 1, l = 0, r = -1;
    for (int i = 1; i < n; ++i) {
      z[i] = 0;
      if (i <= r) z[i] = min(z[i - l], r - i + 1);
      while (i + z[i] < n && s[n - i - z[i] - 1] == s[n - z[i] - 1]) ++z[i];
      if (r < i + z[i] - 1) {
        l = i;
        r = l + z[l] - 1;
      }
      lo = max(lo, z[i] + 1);
    }
    for (int i = 1; i <= n; ++i) {
      dp[i] = 0;
      for (int j = 1; j <= min(4, i); ++j) {
        dp[i] = (dp[i] + dp[i - j] * f(n - i, j)) % mod;
      }
      if (i >= lo) {
        ans = (ans + dp[i]) % mod;
      }
    }
    printf("%lld\n", ans);
  }
}
