#include <bits/stdc++.h>   using namespace std;   const long long mod = 1e9 + 7;   struct SuffixArray {     string a;     long long N, m;     vector<long long> SA, LCP, x, y, w, c;     SuffixArray(string _a, long long m = 256)         : a(    + _a),           N(a.length()),           m(m),           SA(N),           LCP(N),           x(N),           y(N),           w(max(m, N)),           c(N) {       a[0] = 0;       DA();       kasaiLCP();       {         rotate(SA.begin(), SA.begin() + 1, SA.end());         SA.pop_back();       };       {         rotate(LCP.begin(), LCP.begin() + 1, LCP.end());         LCP.pop_back();       };       a = a.substr(1, a.size());       for (long long i = 0; i < (long long)SA.size(); ++i) --SA[i];     }     inline bool cmp(const long long a, const long long b, const long long l) {       return (y[a] == y[b] && y[a + l] == y[b + l]);     }     void Sort() {       for (long long i = 0; i < m; ++i) w[i] = 0;       for (long long i = 0; i < N; ++i) ++w[x[y[i]]];       for (long long i = 0; i < m - 1; ++i) w[i + 1] += w[i];       for (long long i = N - 1; i >= 0; --i) SA[--w[x[y[i]]]] = y[i];     }     void DA() {       for (long long i = 0; i < N; ++i) x[i] = a[i], y[i] = i;       Sort();       for (long long i, j = 1, p = 1; p < N; j <<= 1, m = p) {         for (p = 0, i = N - j; i < N; i++) y[p++] = i;         for (long long k = 0; k < N; ++k)           if (SA[k] >= j) y[p++] = SA[k] - j;         Sort();         for (swap(x, y), p = 1, x[SA[0]] = 0, i = 1; i < N; ++i)           x[SA[i]] = cmp(SA[i - 1], SA[i], j) ? p - 1 : p++;       }     }     void kasaiLCP() {       for (long long i = 0; i < N; i++) c[SA[i]] = i;       for (long long i = 0, j, k = 0; i < N; LCP[c[i++]] = k)         if (c[i] > 0)           for (k ? k-- : 0, j = SA[c[i] - 1]; a[i + k] == a[j + k]; k++)             ;         else           k = 0;     }   };   const long long maxN = 100224;   struct BIT {     long long data[maxN] = {0};     void update(long long idx, long long val) {       while (idx < maxN) {         data[idx] += val;         idx += idx & -idx;       }     }     void update(long long l, long long r, long long val) {       update(l, val);       update(r + 1, -val);     }     long long query(long long idx) {       long long res = 0;       while (idx > 0) {         res += data[idx];         idx -= idx & -idx;       }       return res;     }     long long query(long long l, long long r) { return query(r) - query(l); }   };   struct LazyBIT {     BIT bitAdd, bitSub;     void update(long long l, long long r, long long val) {       bitAdd.update(l, r, val);       bitSub.update(l, r, (l - 1) * val);       bitSub.update(r + 1, (-r + l - 1) * val);     }     long long query(long long idx) {       return idx * bitAdd.query(idx) - bitSub.query(idx);     }     long long query(long long l, long long r) { return query(r) - query(l - 1); }   };   const int N = 300010;   long long cum[N + 5][4];   long long maker(long long l, long long r) {     return (cum[r][1] - cum[l - 1][1]) * (cum[r][2] - cum[l - 1][2]) *            (cum[r][3] - cum[l - 1][3]) % mod;   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(NULL);     string a, b, c;     long long msz = 0;     cin >> a >> b >> c;     msz = min(a.size(), min(b.size(), c.size()));     string s = a +  #  + b +  *  + c;     long long apos = 0;     long long h1 = a.size();     long long bpos = h1 + 1;     long long h2 = bpos + b.size();     long long cpos = h2 + 1;     SuffixArray sa(s, 256);     vector<pair<long long, long long> > v(sa.SA.size());     long long p = 0;     for (auto u : sa.SA) {       if (p != 0) {         cum[p][1] = cum[p - 1][1];         cum[p][2] = cum[p - 1][2];         cum[p][3] = cum[p - 1][3];       }       if (u == h1 || u == h2)         v[p].first = 0;       else if (u >= cpos) {         v[p].first = 3;         cum[p][3]++;       } else if (u >= bpos) {         v[p].first = 2;         cum[p][2]++;       } else {         v[p].first = 1;         cum[p][1]++;       }       p++;     }     p = 0;     for (auto u : sa.LCP) {       v[p].second = u;       p++;     }     vector<pair<long long, long long> > lol;     LazyBIT B;     for (long long i = 0; i < v.size(); i++) {       if (lol.size() == 0) {         if (v[i].second != 0) lol.push_back({i - 1, v[i].second});       } else if (v[i].second > lol[lol.size() - 1].second) {         lol.push_back({i - 1, v[i].second});       } else if (v[i].second < lol[lol.size() - 1].second) {         long long mnmn = 10000000;         while (lol[lol.size() - 1].second > v[i].second) {           long long lt, rt, sz;           lt = lol[lol.size() - 1].first;           rt = i - 1;           mnmn = min(mnmn, lt);           long long make = maker(lt, rt);           long long hi = lol[lol.size() - 1].second;           long long lo = 1;           lol.pop_back();           if (lol.size() != 0) {             lo = lol[lol.size() - 1].second + 1;           }           lo = max(lo, v[i].second + 1);           if (make != 0) B.update(lo, hi, make);           if (lol.size() == 0) break;         }         if (v[i].second != 0) {           if (lol.size() == 0)             lol.push_back({mnmn, v[i].second});           else if (lol[lol.size() - 1].second < v[i].second)             lol.push_back({mnmn, v[i].second});         }       }     }     while (lol.size()) {       long long lt, rt, sz;       lt = lol[lol.size() - 1].first;       rt = v.size() - 1;       long long make = maker(lt, rt);       long long hi = lol[lol.size() - 1].second;       long long lo = 1;       lol.pop_back();       if (lol.size() != 0) {         lo = lol[lol.size() - 1].second + 1;       }       if (make != 0) B.update(lo, hi, make);     }     for (long long i = 1; i <= msz; i++) {       cout << B.query(i, i) % mod <<    ;     }   }   