#include <bits/stdc++.h>
using namespace std;
const int MAXN = 3050;
const int MOD = (int)1e9 + 7;
struct Hash {
  int P = 1777771, MOD[2], PI[2];
  vector<int> h[2], pi[2];
  Hash(const string& s) {
    MOD[0] = 999727999;
    MOD[1] = 1070777777;
    PI[0] = 325255434;
    PI[1] = 10018302;
    for (int k = (0); k < (int)(2); k++)
      h[k].resize(((int)s.size()) + 1), pi[k].resize(((int)s.size()) + 1);
    for (int k = (0); k < (int)(2); k++) {
      h[k][0] = 0;
      pi[k][0] = 1;
      long long p = 1;
      for (int i = (1); i < (int)(((int)s.size()) + 1); i++) {
        h[k][i] = (h[k][i - 1] + p * s[i - 1]) % MOD[k];
        pi[k][i] = (1LL * pi[k][i - 1] * PI[k]) % MOD[k];
        p = (p * P) % MOD[k];
      }
    }
  }
  long long get(int s, int e) {
    long long r[2];
    for (int k = (0); k < (int)(2); k++) {
      r[k] = (h[k][e] - h[k][s] + MOD[k]) % MOD[k];
      r[k] = (1LL * r[k] * pi[k][s]) % MOD[k];
    }
    return (r[0] << 32) | r[1];
  }
};
int add(int a, int b) {
  a += b;
  if (a >= MOD) a -= MOD;
  return a;
}
int n, dp[MAXN][MAXN];
struct custom_hash {
  static uint64_t splitmix64(uint64_t x) {
    x += 0x9e3779b97f4a7c15;
    x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
    x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
    return x ^ (x >> 31);
  }
  size_t operator()(uint64_t x) const {
    static const uint64_t FIXED_RANDOM =
        chrono::steady_clock::now().time_since_epoch().count();
    return splitmix64(x + FIXED_RANDOM);
  }
};
unordered_set<long long, custom_hash> M;
int main() {
  long long fa, fb, fc, fd;
  string f;
  f = "0011";
  fa = Hash(f).get(0, ((int)f.size()));
  f = "0101";
  fb = Hash(f).get(0, ((int)f.size()));
  f = "1110";
  fc = Hash(f).get(0, ((int)f.size()));
  f = "1111";
  fd = Hash(f).get(0, ((int)f.size()));
  int ans = 0;
  dp[0][0] = 1;
  while (scanf("%d", &n) >= 1) {
    string t(n, '.');
    for (int i = (0); i < (int)(n); i++) scanf(" %c", &t[i]);
    Hash H(t);
    M.clear();
    M.reserve((long long)n * n / 2);
    string s;
    for (int z = (0); z < (int)(n); z++) {
      s.push_back(t[z]);
      dp[((int)s.size())][((int)s.size())] = 1;
      for (int j = ((int)s.size()) - 1; j >= 0; j--) {
        for (int k = 1; k <= 4 && j + k <= ((int)s.size()); k++) {
          if (k == 4) {
            long long h = H.get(j, j + k);
            if (h == fa || h == fb || h == fc || h == fd) break;
          }
          dp[j][((int)s.size())] =
              add(dp[j][((int)s.size())], dp[j + k][((int)s.size())]);
        }
      }
      for (int i = (0); i < (int)(((int)s.size())); i++) {
        long long h = H.get(i, ((int)s.size()));
        if (!M.count(h)) {
          ans = add(ans, dp[i][((int)s.size())]);
          M.insert(h);
        }
      }
      printf("%d\n", ans);
    }
  }
  return 0;
}
