#include <bits/stdc++.h>
using namespace std;
const int DIV = 1000000007;
int main(int argc, char* argv[]) {
  FILE* f = stdin;
  int m;
  fscanf(f, "%d", &m);
  long long total = 0;
  vector<vector<long long>> num(m);
  for (int i = 0; i < m; i++) {
    num[i].resize(m + 1, 0);
    num[i][i] = 1;
  }
  string s;
  for (int ii = 0; ii < m; ii++) {
    int cur;
    fscanf(f, "%d", &cur);
    s = string(cur == 0 ? "0" : "1") + s;
    int max = 0;
    bool withLast = true;
    if (ii >= 3) {
      string last = s.substr(0, 4);
      if (last == "1100" || last == "1010" || last == "0111" || last == "1111")
        withLast = false;
    }
    vector<int> z(ii + 1, 0);
    for (int i = 1, l = 0, r = 0; i <= ii; ++i) {
      if (i <= r) z[i] = min(r - i + 1, z[i - l]);
      while (i + z[i] <= ii && s[z[i]] == s[i + z[i]]) ++z[i];
      if (i + z[i] - 1 > r) l = i, r = i + z[i] - 1;
      if (z[i] > max) max = z[i];
    }
    for (int l = 0; l <= ii; l++) {
      int idx = ii;
      for (int j = 0; j < 3 && idx >= 0; j++) {
        num[l][ii + 1] += num[l][idx];
        idx--;
      }
      if (idx >= 0 && withLast) num[l][ii + 1] += num[l][idx];
      num[l][ii + 1] %= DIV;
      if (l + max <= ii) {
        total += num[l][ii + 1];
        total %= DIV;
      }
    }
    printf("%I64d\n", total);
  }
  return 0;
}
