#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("inline")
using namespace std;
const int inf = 0x3f3f3f3f;
const int N = 3010, MOD = 1e9 + 7;
struct NODE {
  int ch[26];
  int len, fa;
  NODE() {
    memset(ch, 0, sizeof(ch));
    len = 0;
  }
} dian[N << 1];
int las = 1, tot = 1;
void init() {
  las = tot = 1;
  for (int i = 0; i < (N << 1); i++) {
    memset(dian[i].ch, 0, sizeof dian[i].ch);
    dian[i].len = dian[i].fa = 0;
  }
}
void add(int c) {
  int p = las;
  int np = las = ++tot;
  dian[np].len = dian[p].len + 1;
  for (; p && !dian[p].ch[c]; p = dian[p].fa) dian[p].ch[c] = np;
  if (!p)
    dian[np].fa = 1;
  else {
    int q = dian[p].ch[c];
    if (dian[q].len == dian[p].len + 1)
      dian[np].fa = q;
    else {
      int nq = ++tot;
      dian[nq] = dian[q];
      dian[nq].len = dian[p].len + 1;
      dian[q].fa = dian[np].fa = nq;
      for (; p && dian[p].ch[c] == q; p = dian[p].fa) dian[p].ch[c] = nq;
    }
  }
}
long long f[N];
int s[N];
void up(long long &x, long long y) { x = (x + y) % MOD; }
int main() {
  std::ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  int m;
  cin >> m;
  long long ans = 0;
  init();
  for (int i = 1; i <= m; i++) {
    char ch;
    cin >> ch;
    add(ch - '0');
    s[i] = ch - '0';
    int len = dian[dian[las].fa].len + 1;
    f[i + 1] = 1;
    for (int j = i; j; j--) {
      f[j] = f[j + 1];
      if (j + 1 <= i) up(f[j], f[j + 2]);
      if (j + 2 <= i) up(f[j], f[j + 3]);
      if (j + 3 <= i &&
          (!(s[j] == 0 && s[j + 1] == 0 && s[j + 2] == 1 && s[j + 3] == 1)) &&
          (!(s[j] == 0 && s[j + 1] == 1 && s[j + 2] == 0 && s[j + 3] == 1)) &&
          (!(s[j] == 1 && s[j + 1] == 1 && s[j + 2] == 1)))
        up(f[j], f[j + 4]);
    }
    for (int j = 1; j <= i - len + 1; j++) up(ans, f[j]);
    cout << ans << '\n';
  }
  return 0;
}
