#include <bits/stdc++.h>   using namespace std;   int n;   long long int dp[3005][3005];   int a[3005];   int tree[3005 * 3005][2];   int cnt = 0;   long long int check(int t) {     return !((a[t - 3] == 0 && a[t - 2] == 0 && a[t - 1] == 1 && a[t] == 1) ||              (a[t - 3] == 0 && a[t - 2] == 1 && a[t - 1] == 0 && a[t] == 1) ||              (a[t - 3] == 1 && a[t - 2] == 1 && a[t - 1] == 1 && a[t] == 0) ||              (a[t - 3] == 1 && a[t - 2] == 1 && a[t - 1] == 1 && a[t] == 1));   }   int main() {     scanf( %d , &n);     for (int i = 1; i <= n; i++) {       scanf( %d , &a[i]);     }     for (int i = 1; i <= n; i++)       for (int j = i - 1; j <= n; j++) {         if (j < i)           dp[i][j] = 1;         else {           for (int k = 1; k <= min(j, (check(j) ? 4 : 3)); k++)             dp[i][j] = (dp[i][j] + dp[i][j - k]) % 1000000007;         }       }     long long int ans = 0;     for (int i = 1; i <= n; i++) {       int p = 0;       for (int j = i; j >= 1; j--) {         if (tree[p][a[j]])           p = tree[p][a[j]];         else {           ans = (ans + dp[j][i]) % 1000000007;           tree[p][a[j]] = cnt += 1;           p = tree[p][a[j]];         }       }       printf( %d n , ans);     }     return 0;   }   