#include <bits/stdc++.h>
using namespace std;
void _main();
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  _main();
}
const int inf = INT_MAX / 2;
const long long infl = 1LL << 60;
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
template <int MOD>
struct ModInt {
  static const int Mod = MOD;
  unsigned x;
  ModInt() : x(0) {}
  ModInt(signed sig) { x = sig < 0 ? sig % MOD + MOD : sig % MOD; }
  ModInt(signed long long sig) { x = sig < 0 ? sig % MOD + MOD : sig % MOD; }
  int get() const { return (int)x; }
  ModInt &operator+=(ModInt that) {
    if ((x += that.x) >= MOD) x -= MOD;
    return *this;
  }
  ModInt &operator-=(ModInt that) {
    if ((x += MOD - that.x) >= MOD) x -= MOD;
    return *this;
  }
  ModInt &operator*=(ModInt that) {
    x = (unsigned long long)x * that.x % MOD;
    return *this;
  }
  ModInt &operator/=(ModInt that) { return *this *= that.inverse(); }
  ModInt operator+(ModInt that) const { return ModInt(*this) += that; }
  ModInt operator-(ModInt that) const { return ModInt(*this) -= that; }
  ModInt operator*(ModInt that) const { return ModInt(*this) *= that; }
  ModInt operator/(ModInt that) const { return ModInt(*this) /= that; }
  ModInt inverse() const {
    long long a = x, b = MOD, u = 1, v = 0;
    while (b) {
      long long t = a / b;
      a -= t * b;
      std::swap(a, b);
      u -= t * v;
      std::swap(u, v);
    }
    return ModInt(u);
  }
  bool operator==(ModInt that) const { return x == that.x; }
  bool operator!=(ModInt that) const { return x != that.x; }
  ModInt operator-() const {
    ModInt t;
    t.x = x == 0 ? 0 : Mod - x;
    return t;
  }
};
template <int MOD>
ostream &operator<<(ostream &st, const ModInt<MOD> a) {
  st << a.get();
  return st;
};
template <int MOD>
ModInt<MOD> operator^(ModInt<MOD> a, unsigned long long k) {
  ModInt<MOD> r = 1;
  while (k) {
    if (k & 1) r *= a;
    a *= a;
    k >>= 1;
  }
  return r;
}
int getrandmax() {
  static uint32_t y = time(NULL);
  y ^= (y << 13);
  y ^= (y >> 17);
  y ^= (y << 5);
  return abs((int)y);
}
int getrand(int l, int r) { return getrandmax() % (r - l + 1) + l; }
int N, A[3010];
ModInt<1000000007> ans = 0;
inline bool check(int v0, int v1, int v2, int v3) {
  if (v0 == 0 and v1 == 0 and v2 == 1 and v3 == 1) return false;
  if (v0 == 0 and v1 == 1 and v2 == 0 and v3 == 1) return false;
  if (v0 == 1 and v1 == 1 and v2 == 1 and v3 == 0) return false;
  if (v0 == 1 and v1 == 1 and v2 == 1 and v3 == 1) return false;
  return true;
}
struct Node {
  int pre[3];
  ModInt<1000000007> dp[4];
  Node *c[2];
  Node() {
    c[0] = c[1] = 0;
    pre[0] = pre[1] = pre[2] = -1;
    dp[0] = dp[1] = dp[2] = dp[3] = 0;
  }
};
struct HealthyTrie01 {
  Node *root;
  HealthyTrie01() {
    root = new Node();
    root->dp[0] = 1;
  }
  void add(int i) { update(root, i); }
  void update(Node *&x, int i) {
    if (i < 0) return;
    int a = A[i];
    if (x->c[a] != 0) {
      update(x->c[a], i - 1);
      return;
    }
    Node *nxt = new Node();
    nxt->pre[0] = a;
    nxt->pre[1] = x->pre[0];
    nxt->pre[2] = x->pre[1];
    if (check(a, x->pre[0], x->pre[1], x->pre[2])) nxt->dp[0] = x->dp[3];
    nxt->dp[1] = x->dp[0] + x->dp[1] + x->dp[2] + x->dp[3];
    nxt->dp[2] = x->dp[1];
    nxt->dp[3] = x->dp[2];
    ans += nxt->dp[0] + nxt->dp[1] + nxt->dp[2] + nxt->dp[3];
    x->c[a] = nxt;
    update(x->c[a], i - 1);
  }
};
void _main() {
  cin >> N;
  for (int i = 0; i < N; i++) cin >> A[i];
  HealthyTrie01 trie;
  for (int i = 0; i < N; i++) {
    trie.add(i);
    printf("%d\n", ans.get());
  }
}
