#include <bits/stdc++.h>
#pragma GCC optimize(2)
const int MAXN = 3300;
const int P = 1E9 + 7;
char s[MAXN];
int f[MAXN];
int nxt[MAXN * MAXN][2];
int main() {
  int m, cnt = 1, ans = 0;
  scanf("%d", &m);
  for (int n = 1; n <= m; n++) {
    scanf("%s", s + n);
    f[n + 1] = 1;
    int p = 1;
    for (int i = n; i >= 1; i--) {
      f[i] = 0;
      int x = 0;
      for (int j = 0; j < 4 && i + j <= n; j++) {
        x = 2 * x + s[i + j] - '0' + 1;
        if (x != 18 && x != 20 && x != 29 && x != 30)
          f[i] = (f[i] + f[i + j + 1]) % P;
      }
      if (!nxt[p][s[i] - '0']) {
        ans = (ans + f[i]) % P;
        nxt[p][s[i] - '0'] = ++cnt;
      }
      p = nxt[p][s[i] - '0'];
    }
    printf("%d\n", ans);
  }
  return 0;
}
