#include <bits/stdc++.h>
using namespace std;
inline char gc() { return getchar(); }
template <class T>
int read(T &ans) {
  ans = 0;
  char ch = gc();
  T f = 1;
  while (!isdigit(ch)) {
    if (ch == EOF) return -1;
    if (ch == '-') f = -1;
    ch = gc();
  }
  while (isdigit(ch)) ans = ans * 10 + ch - '0', ch = gc();
  ans *= f;
  return 1;
}
template <class T1, class T2>
int read(T1 &a, T2 &b) {
  return read(a) != EOF && read(b) != EOF ? 2 : EOF;
}
template <class T1, class T2, class T3>
int read(T1 &a, T2 &b, T3 &c) {
  return read(a, b) != EOF && read(c) != EOF ? 3 : EOF;
}
const int Maxn = 11000000;
const int inf = 0x3f3f3f3f;
const int mod = 1000000007;
int n, f[5100], a[Maxn], ans, ch[Maxn][2], cnt = 1;
signed main() {
  read(n);
  f[0] = 1;
  for (int i = 1; i <= n; i++) read(a[i]);
  for (int i = 1; i <= n; i++) {
    memset(f, 0, sizeof(f));
    f[i + 1] = 1;
    int now = 1;
    for (int j = i; j >= 1; j--) {
      for (int k = 1; k <= 3; k++) f[j] = (f[j] + f[j + k]) % mod;
      if (j <= i - 3) {
        if (!a[j]) {
          if (a[j + 1]) {
            if (a[j + 2] || !a[j + 3]) f[j] = (f[j] + f[j + 4]) % mod;
          } else {
            if (!a[j + 2] || !a[j + 3]) f[j] = (f[j] + f[j + 4]) % mod;
          }
        } else if (a[j + 3]) {
          if (!a[j + 1] || !a[j + 2]) f[j] = (f[j] + f[j + 4]) % mod;
        } else if (!a[j + 1] || !a[j + 2])
          f[j] = (f[j] + f[j + 4]) % mod;
      }
      if (!ch[now][a[j]]) {
        ch[now][a[j]] = ++cnt;
        ans = (ans + f[j]) % mod;
      }
      now = ch[now][a[j]];
    }
    printf("%d\n", ans);
  }
  return 0;
}
