#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 3010;
const long long INF = 2000000100;
const long long MOD = 1000000007;
inline long long mult(long long a, long long b) {
  return ((a % MOD) * (b % MOD)) % MOD;
}
inline long long add(long long a, long long b) {
  return ((a % MOD) + (b % MOD)) % MOD;
}
long long N, NT, ans, S = 1;
string B;
vector<long long> dp;
struct state {
  long long n[2];
  state() {
    n[0] = -1;
    n[1] = -1;
  }
  state(long long n0, long long n1) {
    n[0] = n0;
    n[1] = n1;
  }
};
vector<state> st;
long long suf[MAXN][5];
bool bad(string s) {
  return s == "0011" || s == "0101" || s == "1110" || s == "1111";
}
void addstate(long long s, bool b) {
  if (st[suf[s][1]].n[b] != -1) {
    suf[s][0] = st[suf[s][1]].n[b];
    return;
  }
  suf[s][0] = S;
  st[suf[s][1]].n[b] = S;
  st.push_back(state(-1, -1));
  dp.push_back(0);
  long long l = N - s + 1;
  if (l >= 1) dp[S] = add(dp[S], dp[suf[s][1]]);
  if (l >= 2) dp[S] = add(dp[S], dp[suf[s][2]]);
  if (l >= 3) dp[S] = add(dp[S], dp[suf[s][3]]);
  if (l >= 4 && !bad(B.substr(N - 4, 4))) dp[S] = add(dp[S], dp[suf[s][4]]);
  ans = add(ans, dp[S]);
  S++;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> NT;
  char c;
  dp.push_back(1);
  st.push_back(state(-1, -1));
  for (N = 1; N <= NT; N++) {
    cin >> c;
    B += c;
    for (int i = 1; i <= N; i++) {
      for (int j = 3; j >= 0; j--) suf[i][j + 1] = suf[i][j];
      addstate(i, c - '0');
    }
    cout << ans << "\n";
  }
}
