#include "bits/stdc++.h"
using  namespace  std;
typedef  long long ll;
#define all(x) x.begin(), x.end()
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int N = 109;
const int MOD = 1e9 + 7;
ll c[N][N];

ll stars_and_bars(int n, int r){
        //#ways to distribute n identical objects over r buckets
        if(r == 0){
                //we have no buckets
                return !n;
        }
        return c[n + r - 1][n];
}
void solve(){
        //generating the array randomly
        int n = rng() % 25;
        int a[n];
        for(int i = 0; i < n; i++)
                a[i] = rng() % 1000;

        
        
        //The trivial O(n^2) solution
        ll ans = 0;
        for(int i = 0; i < n; i++){
                ll sum = 0;
                for(int j = i; j < n; j++){
                        sum += a[j];
                        int len = j - i + 1;
                        ans += 1ll * len * len * len * sum % MOD;
                        ans %= MOD;
                }
        }
        cout<<ans<<" ";
        ans = 0;
        
        //The technique of ordered pairs solution
        for(int i = 0; i < n; i++){
                int c = 0;
                for(int L = 0; L <= i; L++){
                        for(int R = i; R < n; R++){
                                for(int x = L; x <= R; x++){
                                        for(int y = L; y <= R; y++){
                                                for(int z = L; z <= R; z++){
                                                        c++;
                                                }
                                        }
                                }
                        }
                }
                ans += c * a[i] % MOD;
                ans %= MOD;
        }
        cout<<ans<<" ";
        ans = 0;
        
        //The optimization
        for(int i = 0; i < n; i++){
                ll cc = 0;
                for(int L = 0; L <= 5; L++){
                        for(int M = 0; M <= 5; M++){
                                int R = 5 - L - M;
                                if(R < 0) continue;
                                if(L + M > 0 && R + M > 0){
                                        cc += stars_and_bars(L, i) * stars_and_bars(R, n - i - 1) % MOD;
                                        cc %= MOD;
                                }
                        }
                }
                ans += cc * a[i] % MOD;
                ans %= MOD;
        }
        cout<<ans<<"\n";
}
int main(){
        cin.tie(0);
        cin.sync_with_stdio(0);
        
        c[0][0] = 1;
        for(int i = 1; i < N; i++){
                c[i][0] = 1;
                for(int j = 1; j <= i; j++)
                        c[i][j] = (c[i - 1][j - 1] + c[i - 1][j]) % MOD;
        }
        
        int T; T = 4;
        while(T--)
                solve();
}
/*
 * Think twice, code once
 * Think of different approaches to tackle a problem: write them down.
 * Think of different views of the problem. don't look from only one side.
 * don't get stuck in one approach.
 * common mistakes: over_flow
 *                  - out_of_bound index
 *                  -infinite loop
 *                  -corner cases
 *                  -duplication counting.
 */