#include <bits/stdc++.h>
using namespace std;
long long ans[3002][3002], dp[3002][3002], i, j, m, mod = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  string s = "";
  char x;
  cin >> m;
  for (i = 0; i < m; ++i) {
    ans[i][i] = 1;
  }
  for (i = 0; i < m; ++i) {
    cin >> x;
    s += x;
    for (j = 0; j < i; ++j) {
      if (s[j] == x) {
        if (j == 0)
          dp[j][i] = 1;
        else
          dp[j][i] = dp[j - 1][i - 1] + 1;
      }
    }
    string str = "";
    for (j = i; j >= 0; --j) {
      str = s[j] + str;
      if (i - j >= 0) {
        ans[j][i + 1] += ans[j][i] % mod;
      }
      if (i - j >= 1) {
        ans[j][i + 1] += ans[j][i - 1] % mod;
      }
      if (i - j >= 2) {
        ans[j][i + 1] += ans[j][i - 2] % mod;
      }
      if (i - j > 2) {
        string morze = "";
        morze += str[i - j - 3];
        morze += str[i - j - 2];
        morze += str[i - j - 1];
        morze += str[i - j];
        if (morze != "0011" && morze != "0101" && morze != "1110" &&
            morze != "1111")
          ans[j][i + 1] += ans[j][i - 3] % mod;
      }
    }
  }
  long long answer1 = 0;
  for (i = 0; i < m; ++i) {
    long long maxx = 0;
    for (j = 0; j < i; ++j) {
      maxx = max(maxx, dp[j][i]);
    }
    long long answer = 0;
    for (j = 0; j <= i - maxx; j++) {
      answer += ans[j][i + 1] % mod;
    }
    answer1 += answer % mod;
    answer1 %= mod;
    cout << answer1 << endl;
  }
  return 0;
}
