#include #include #include #define mo 1000000007 using namespace std; int f[4000010],g[4000010],n; char s[4000010]; inline int mod(int x) { if (x>=mo) x-=mo; return x; } void solve(int l,int r) { if (l==r) { if (l&&l>1; int len=mid-l+1; solve(l,mid); for (int i=l;i<=mid;i++) f[i+len]=mod(f[i+len]+g[i]); solve(mid+1,r); for (int i=l;i<=mid;i++) g[i+len]=mod(g[i+len]+g[i]); } int main() { int cas; scanf("%d",&cas); while (cas--) { scanf("%s",s+1); n=strlen(s+1)+1; int N=1; while (N<=n) N<<=1; for (int i=0;i