#include <bits/stdc++.h>
/*
** Author: wkwkwill (Willy I. K.)
** 2020/08/30
*/
using namespace std;
using ll = long long int;

ll BIG = 1e18 + 1;
ll MOD = 1e9 + 7;

void solve();

ll fastpow(ll x, ll y, ll n = BIG)
{
    x %= n;
    ll ans = 1;
    while (y > 0)
    {
        if (y & 1) ans = (ans * x) % n;
        x = (x * x) % n;
        y >>= 1;
    }
    return ans;
}

bool sortPairSecond(pair<ll, ll> &a, pair<ll, ll> &b)
{
    return a.second < b.second;
}

bool sortPairFirst(pair<int, bool> &a, pair<int, bool> &b)
{
    return a.first < b.first;
}

int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
	return 0;
}

int KPK(int n, int x) //KPK x dekat ke n
{
    if(x > n) return x;
    n = n + x/2;
    n = n - (n%x);
    return n;
}

void solve()
{

    ll n;
    cin >> n;
    vector<ll> a(n);
    for (int i = 0; i < n; ++i)
    {
        cin >> a[i];
    }
    if (n == 1)
    {
        cout << "1 1" << '\n';
        cout << '-' << a[0] << '\n';
        cout << "1 1" << '\n';
        cout << "0" << '\n';
        cout << "1 1" << '\n';
        cout << "0" << '\n';
    }
    else
    {
        cout << "1 1" << '\n';
        cout << n - a[0] << '\n';
        a[0] = n;
        cout << "2 " << n << '\n';
        for (int i = 1; i < n; ++i)
        {
            ll kpk = (a[i] * n);
            cout << kpk - a[i] << ' ';
            a[i] = kpk;
        }
        cout << '\n';
        cout << "1 " << n << '\n';
        for (int i = 0; i < n; ++i)
        {
            cout << -1 * a[i] << ' ';
        }
        cout << '\n';
    }

}
/*

4
1 23 2 4
4 92 8 4
3 69

4
1 115 2 4
+3 +9 +6
4 124 8 4
        +0
4 124 8 4
-4 -124 -8 -4

*/


#include <bits/stdc++.h>
/*
** Author: wkwkwill (Willy I. K.)
** 2020/08/30
*/
using namespace std;
using ll = long long int;

ll BIG = 1e18 + 1;
ll MOD = 1e9 + 7;

void solve();

ll fastpow(ll x, ll y, ll n = BIG)
{
    x %= n;
    ll ans = 1;
    while (y > 0)
    {
        if (y & 1) ans = (ans * x) % n;
        x = (x * x) % n;
        y >>= 1;
    }
    return ans;
}

bool sortPairSecond(pair<ll, ll> &a, pair<ll, ll> &b)
{
    return a.second < b.second;
}

bool sortPairFirst(pair<int, bool> &a, pair<int, bool> &b)
{
    return a.first < b.first;
}

int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
	return 0;
}

int KPK(int n, int x) //KPK x dekat ke n
{
    if(x > n) return x;
    n = n + x/2;
    n = n - (n%x);
    return n;
}

void solve()
{

    ll n;
    cin >> n;
    vector<ll> a(n);
    for (int i = 0; i < n; ++i)
    {
        cin >> a[i];
    }
    if (n == 1)
    {
        cout << "1 1" << '\n';
        cout << n - a[0] << '\n';
        cout << "1 1" << '\n';
        cout << "0" << '\n';
        cout << "1 1" << '\n';
        cout << "0" << '\n';
    }
    else
    {
        cout << "1 1" << '\n';
        cout << n - a[0] << '\n';
        a[0] = n;
        cout << "2 " << n << '\n';
        for (int i = 1; i < n; ++i)
        {
            ll kpk = KPK(a[i], n);
            while ((kpk - a[i]) % (n-1) != 0)
            {
                kpk += n;
            }
            cout << kpk - a[i] << ' ';
            a[i] = kpk;
        }
        cout << '\n';
        cout << "1 4" << '\n';
        for (int i = 0; i < n; ++i)
        {
            cout << "-" << a[i] << ' ';
        }
        cout << '\n';
    }

}
/*
4
1 115 2 4
+3 +9 +6
4 124 8 4
        +0
4 124 8 4
-4 -124 -8 -4

*/


#include <bits/stdc++.h>
/*
** Author: wkwkwill (Willy I. K.)
** 2020/08/30
*/
using namespace std;
using ll = long long int;

ll BIG = 1e18 + 1;
ll MOD = 1e9 + 7;

void solve();

ll fastpow(ll x, ll y, ll n = BIG)
{
    x %= n;
    ll ans = 1;
    while (y > 0)
    {
        if (y & 1) ans = (ans * x) % n;
        x = (x * x) % n;
        y >>= 1;
    }
    return ans;
}

bool sortPairSecond(pair<ll, ll> &a, pair<ll, ll> &b)
{
    return a.second < b.second;
}

bool sortPairFirst(pair<int, bool> &a, pair<int, bool> &b)
{
    return a.first < b.first;
}

int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
	return 0;
}

int KPK(int n, int x) //KPK x dekat ke n
{
    if(x > n) return x;
    n = n + x/2;
    n = n - (n%x);
    return n;
}

void solve()
{

    ll n;
    cin >> n;
    vector<ll> a(n);
    for (int i = 0; i < n; ++i)
    {
        cin >> a[i];
    }
    if (n == 1)
    {
        cout << "1 1" << '\n';
        cout << '-' << a[0] << '\n';
        cout << "1 1" << '\n';
        cout << "0" << '\n';
        cout << "1 1" << '\n';
        cout << "0" << '\n';
    }
    else
    {
        cout << "1 1" << '\n';
        cout << n - a[0] << '\n';
        a[0] = n;
        cout << "2 " << n << '\n';
        for (int i = 1; i < n; ++i)
        {
            ll kpk = KPK(a[i], n);
            while ((kpk - a[i]) % (n-1) != 0)
            {
                kpk += n;
            }
            cout << kpk - a[i] << ' ';
            a[i] = kpk;
        }
        cout << '\n';
        cout << "1 4" << '\n';
        for (int i = 0; i < n; ++i)
        {
            cout << "-" << a[i] << ' ';
        }
        cout << '\n';
    }

}
/*
4
1 115 2 4
+3 +9 +6
4 124 8 4
        +0
4 124 8 4
-4 -124 -8 -4

*/


#include<bits/stdc++.h>
using namespace std;

using ll = long long;

using pii = pair<int, int>;
using pid = pair<int, double>;
using pdd = pair<double, double>;
using pic = pair<int, char>;
using pllll = pair<ll, ll>;
using pllc = pair<ll, char>;
using pill = pair<int, ll>;
using pss = pair<string, string>;
using pis = pair<int, string>;
using plls = pair<ll, string>;
using plld = pair<ll, double>;

using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vs = vector<string>;
using vll = vector<ll>;

#define pb push_back
#define mp make_pair
#define f(i, n) for(int i = 0; i < n; i++)
#define fll(i, n) for(ll i = 0; i < n; i++)
#define F(i, n)	for(int i = 1; i <= n; i++)
#define Fll(i, n) for(ll i = 1; i <= n; i++)
#define fi first
#define se second
#define endl "\n"
#define watch(x) cout << (#x) << " is " << (x) << endl

#define fl fflush(stdout);

int main(){

	ios::sync_with_stdio(false);

	ll n;

    cin >> n;

    vll a(n + 1, 0);

    F(i, n){

        cin >> a[i];

    }

    cout << 1 << " " << n << endl;

    F(i, n){

        ll rem = a[i] % (n - 1);
        if(rem < 0){

            rem += (n - 1);

        }

        cout << n * (n - 1 - rem) << " ";

        a[i] += n * (n - 1 - rem);

    }

    cout << endl;

    cout << 1 << " " << n - 1 << endl;

    F(i, n - 1){

        cout << a[i] * -1 << " ";

        //a[i] *= -1;

    }

    cout << endl;

    cout << n << " " << n << endl;

    cout << -1 * a[n] << endl;

	return 0;

}


#include<bits/stdc++.h>
using namespace std;

using ll = long long;

using pii = pair<int, int>;
using pid = pair<int, double>;
using pdd = pair<double, double>;
using pic = pair<int, char>;
using pllll = pair<ll, ll>;
using pllc = pair<ll, char>;
using pill = pair<int, ll>;
using pss = pair<string, string>;
using pis = pair<int, string>;
using plls = pair<ll, string>;
using plld = pair<ll, double>;

using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vs = vector<string>;
using vll = vector<ll>;

#define pb push_back
#define mp make_pair
#define f(i, n) for(int i = 0; i < n; i++)
#define fll(i, n) for(ll i = 0; i < n; i++)
#define F(i, n)	for(int i = 1; i <= n; i++)
#define Fll(i, n) for(ll i = 1; i <= n; i++)
#define fi first
#define se second
#define endl "\n"
#define watch(x) cout << (#x) << " is " << (x) << endl

#define fl fflush(stdout);

int main(){

	//ios::sync_with_stdio(false);

	ll n;

    cin >> n;

    ll a[n + ];

    f(i, n){

        cin >> a[i];

    }

    cout << 1 << " " << n << endl;

    f(i, n){

        ll rem = a[i] % (n - 1ll);
        if(rem < 0){

            rem += (n - 1ll);

        }

        cout << n * (n - 1ll - rem) << " ";

    }

    cout << endl;

    f(i, n){

        ll rem = a[i] % (n - 1ll);
        if(rem < 0){

            rem += (n - 1ll);

        }

        a[i] += n * (n - 1ll - rem);

    }

    cout << 1 << " " << n - 1ll << endl;

    f(i, n - 1){

        cout << a[i] * -1ll << " ";

        //a[i] *= -1;

    }

    cout << endl;

    cout << n << " " << n << endl;

    cout << -1ll * a[n - 1] << endl;

	return 0;

}


#include<bits/stdc++.h>
using namespace std;

using ll = long long;

using pii = pair<int, int>;
using pid = pair<int, double>;
using pdd = pair<double, double>;
using pic = pair<int, char>;
using pllll = pair<ll, ll>;
using pllc = pair<ll, char>;
using pill = pair<int, ll>;
using pss = pair<string, string>;
using pis = pair<int, string>;
using plls = pair<ll, string>;
using plld = pair<ll, double>;

using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vs = vector<string>;
using vll = vector<ll>;

#define pb push_back
#define mp make_pair
#define f(i, n) for(int i = 0; i < n; i++)
#define fll(i, n) for(ll i = 0; i < n; i++)
#define F(i, n)	for(int i = 1; i <= n; i++)
#define Fll(i, n) for(ll i = 1; i <= n; i++)
#define fi first
#define se second
#define endl "\n"
#define watch(x) cout << (#x) << " is " << (x) << endl

#define fl fflush(stdout);

int main(){

	ios::sync_with_stdio(false);

	ll n;

    cin >> n;

    vll a(n, 0);

    f(i, n){

        cin >> a[i];

    }

    cout << 1 << " " << n << endl;

    f(i, n){

        ll rem = a[i] % (n - 1);
        if(rem < 0){

            rem += (n - 1);

        }

        cout << n * (n - 1 - rem) << " ";

        a[i] += n * (n - 1 - rem);

    }

    cout << endl;

    cout << 1 << " " << n - 1 << endl;

    f(i, n - 1){

        cout << a[i] * -1 << " ";

        //a[i] *= -1;

    }

    cout << endl;

    cout << n << " " << n << endl;

    cout << -1 * a[n - 1] << endl;

	return 0;

}


#include<bits/stdc++.h>
using namespace std;

using ll = long long;

using pii = pair<int, int>;
using pid = pair<int, double>;
using pdd = pair<double, double>;
using pic = pair<int, char>;
using pllll = pair<ll, ll>;
using pllc = pair<ll, char>;
using pill = pair<int, ll>;
using pss = pair<string, string>;
using pis = pair<int, string>;
using plls = pair<ll, string>;
using plld = pair<ll, double>;

using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vs = vector<string>;
using vll = vector<ll>;

#define pb push_back
#define mp make_pair
#define f(i, n) for(int i = 0; i < n; i++)
#define fll(i, n) for(ll i = 0; i < n; i++)
#define F(i, n)	for(int i = 1; i <= n; i++)
#define Fll(i, n) for(ll i = 1; i <= n; i++)
#define fi first
#define se second
#define endl "\n"
#define watch(x) cout << (#x) << " is " << (x) << endl

#define fl fflush(stdout);

int main(){

	//ios::sync_with_stdio(false);

	ll n;

    cin >> n;

    ll a[n + 5];

    f(i, n){

        cin >> a[i];

    }

    cout << 1 << " " << n << endl;

    f(i, n){

        ll rem = a[i] % (n - 1ll);
        if(rem < 0){

            rem += (n - 1ll);

        }

        cout << n * (n - 1ll - rem) << " ";

    }

    cout << endl;

    f(i, n){

        ll rem = a[i] % (n - 1ll);
        if(rem < 0){

            rem += (n - 1ll);

        }

        a[i] += n * (n - 1ll - rem);

    }

    cout << 1 << " " << n - 1ll << endl;

    f(i, n - 1){

        cout << a[i] * -1ll << " ";

        //a[i] *= -1;

    }

    cout << endl;

    cout << n << " " << n << endl;

    cout << -1ll * a[n - 1] << endl;

	return 0;

}


#include<bits/stdc++.h>
using namespace std;

using ll = long long;

using pii = pair<int, int>;
using pid = pair<int, double>;
using pdd = pair<double, double>;
using pic = pair<int, char>;
using pllll = pair<ll, ll>;
using pllc = pair<ll, char>;
using pill = pair<int, ll>;
using pss = pair<string, string>;
using pis = pair<int, string>;
using plls = pair<ll, string>;
using plld = pair<ll, double>;

using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vs = vector<string>;
using vll = vector<ll>;

#define pb push_back
#define mp make_pair
#define f(i, n) for(int i = 0; i < n; i++)
#define fll(i, n) for(ll i = 0; i < n; i++)
#define F(i, n)	for(int i = 1; i <= n; i++)
#define Fll(i, n) for(ll i = 1; i <= n; i++)
#define fi first
#define se second
#define endl "\n"
#define watch(x) cout << (#x) << " is " << (x) << endl

#define fl fflush(stdout);

int main(){

	//ios::sync_with_stdio(false);

	ll n;

    cin >> n;

    vll a(n, 0);

    f(i, n){

        cin >> a[i];

    }

    cout << 1 << " " << n << endl;

    f(i, n){

        ll rem = a[i] % (n - 1);
        if(rem < 0){

            rem += (n - 1);

        }

        cout << n * (n - 1 - rem) << " ";

    }

    cout << endl;

    f(i, n){

        ll rem = a[i] % (n - 1);
        if(rem < 0){

            rem += (n - 1);

        }

        a[i] += n * (n - 1 - rem);

    }

    cout << 1 << " " << n - 1 << endl;

    f(i, n - 1){

        cout << a[i] * -1 << " ";

        //a[i] *= -1;

    }

    cout << endl;

    cout << n << " " << n << endl;

    cout << -1 * a[n - 1] << endl;

	return 0;

}


#include<bits/stdc++.h>
using namespace std;

using ll = long long;

using pii = pair<int, int>;
using pid = pair<int, double>;
using pdd = pair<double, double>;
using pic = pair<int, char>;
using pllll = pair<ll, ll>;
using pllc = pair<ll, char>;
using pill = pair<int, ll>;
using pss = pair<string, string>;
using pis = pair<int, string>;
using plls = pair<ll, string>;
using plld = pair<ll, double>;

using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vs = vector<string>;
using vll = vector<ll>;

#define pb push_back
#define mp make_pair
#define f(i, n) for(int i = 0; i < n; i++)
#define fll(i, n) for(ll i = 0; i < n; i++)
#define F(i, n)	for(int i = 1; i <= n; i++)
#define Fll(i, n) for(ll i = 1; i <= n; i++)
#define fi first
#define se second
#define endl "\n"
#define watch(x) cout << (#x) << " is " << (x) << endl

#define fl fflush(stdout);

int main(){

	//ios::sync_with_stdio(false);

	ll n;

    cin >> n;

    vll a(n, 0);

    f(i, n){

        cin >> a[i];

    }

    cout << 1 << " " << n << endl;

    f(i, n){

        ll rem = a[i] % (n - 1ll);
        if(rem < 0){

            rem += (n - 1ll);

        }

        cout << n * (n - 1ll - rem) << " ";

    }

    cout << endl;

    f(i, n){

        ll rem = a[i] % (n - 1ll);
        if(rem < 0){

            rem += (n - 1ll);

        }

        a[i] += n * (n - 1ll - rem);

    }

    cout << 1 << " " << n - 1ll << endl;

    f(i, n - 1){

        cout << a[i] * -1ll << " ";

        //a[i] *= -1;

    }

    cout << endl;

    cout << n << " " << n << endl;

    cout << -1ll * a[n - 1] << endl;

	return 0;

}


#include<bits/stdc++.h>
using namespace std;

using ll = long long;

using pii = pair<int, int>;
using pid = pair<int, double>;
using pdd = pair<double, double>;
using pic = pair<int, char>;
using pllll = pair<ll, ll>;
using pllc = pair<ll, char>;
using pill = pair<int, ll>;
using pss = pair<string, string>;
using pis = pair<int, string>;
using plls = pair<ll, string>;
using plld = pair<ll, double>;

using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vs = vector<string>;
using vll = vector<ll>;

#define pb push_back
#define mp make_pair
#define f(i, n) for(int i = 0; i < n; i++)
#define fll(i, n) for(ll i = 0; i < n; i++)
#define F(i, n)	for(int i = 1; i <= n; i++)
#define Fll(i, n) for(ll i = 1; i <= n; i++)
#define fi first
#define se second
#define endl "\n"
#define watch(x) cout << (#x) << " is " << (x) << endl

#define fl fflush(stdout);

int main(){

	//ios::sync_with_stdio(false);

	int n;

    cin >> n;

    vi a(n + 1, 0);

    f(i, n){

        cin >> a[i];

    }

    if(n == 1){

        cout << 1 << " " << 1 << endl;

        cout << -1 * a[0] << endl;

        cout << 1 << " " << 1 << endl;

        cout << 0 << endl;

        cout << 1 << " " << 1 << endl;

        cout << 0 << endl;

    }

    else{cout << 1 << " " << n << endl;

    f(i, n){

        ll rem = a[i] % (n - 1ll);
        if(rem < 0){

            rem += (n - 1ll);

        }

        cout << n * (n - 1ll - rem) << " ";

    }

    cout << endl;

    f(i, n){

        ll rem = a[i] % (n - 1ll);
        if(rem < 0){

            rem += (n - 1ll);

        }

        a[i] += n * (n - 1ll - rem);

    }

    cout << 1 << " " << (n - 1ll) << endl;

    f(i, n - 1){

        ll o = a[i] * -1;

        cout << o << " ";

        //a[i] *= -1;

    }

    cout << endl;

    cout << n << " " << n << endl;

    ll out = -1 * a[n - 1];

    cout << out << endl;}

	return 0;

}


#include<bits/stdc++.h>
using namespace std;

using ll = long long;

using pii = pair<int, int>;
using pid = pair<int, double>;
using pdd = pair<double, double>;
using pic = pair<int, char>;
using pllll = pair<ll, ll>;
using pllc = pair<ll, char>;
using pill = pair<int, ll>;
using pss = pair<string, string>;
using pis = pair<int, string>;
using plls = pair<ll, string>;
using plld = pair<ll, double>;

using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vs = vector<string>;
using vll = vector<ll>;

#define pb push_back
#define mp make_pair
#define f(i, n) for(int i = 0; i < n; i++)
#define fll(i, n) for(ll i = 0; i < n; i++)
#define F(i, n)	for(int i = 1; i <= n; i++)
#define Fll(i, n) for(ll i = 1; i <= n; i++)
#define fi first
#define se second
#define endl "\n"
#define watch(x) cout << (#x) << " is " << (x) << endl

#define fl fflush(stdout);

int main(){

	//ios::sync_with_stdio(false);

	int n;

    cin >> n;

    vll a(n + 1, 0);

    f(i, n){

        cin >> a[i];

    }

    cout << 1 << " " << n << endl;

    f(i, n){

        ll rem = a[i] % (n - 1ll);
        if(rem < 0){

            rem += (n - 1ll);

        }

        cout << n * (n - 1ll - rem) << " ";

    }

    cout << endl;

    f(i, n){

        ll rem = a[i] % (n - 1ll);
        if(rem < 0){

            rem += (n - 1ll);

        }

        a[i] += n * (n - 1ll - rem);

    }

    cout << 1 << " " << (n - 1ll) << endl;

    f(i, n - 1){

        cout << a[i] * -1ll << " ";

        //a[i] *= -1;

    }

    cout << endl;

    cout << n << " " << n << endl;

    cout << -1ll * a[n - 1] << endl;

	return 0;

}


#include<bits/stdc++.h>
using namespace std;

using ll = long long;

using pii = pair<int, int>;
using pid = pair<int, double>;
using pdd = pair<double, double>;
using pic = pair<int, char>;
using pllll = pair<ll, ll>;
using pllc = pair<ll, char>;
using pill = pair<int, ll>;
using pss = pair<string, string>;
using pis = pair<int, string>;
using plls = pair<ll, string>;
using plld = pair<ll, double>;

using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vs = vector<string>;
using vll = vector<ll>;

#define pb push_back
#define mp make_pair
#define f(i, n) for(int i = 0; i < n; i++)
#define fll(i, n) for(ll i = 0; i < n; i++)
#define F(i, n)	for(int i = 1; i <= n; i++)
#define Fll(i, n) for(ll i = 1; i <= n; i++)
#define fi first
#define se second
#define endl "\n"
#define watch(x) cout << (#x) << " is " << (x) << endl

#define fl fflush(stdout);

int main(){

	//ios::sync_with_stdio(false);

	int n;

    cin >> n;

    vi a(n + 1, 0);

    f(i, n){

        cin >> a[i];

    }

    cout << 1 << " " << n << endl;

    f(i, n){

        ll rem = a[i] % (n - 1ll);
        if(rem < 0){

            rem += (n - 1ll);

        }

        cout << n * (n - 1ll - rem) << " ";

    }

    cout << endl;

    f(i, n){

        ll rem = a[i] % (n - 1ll);
        if(rem < 0){

            rem += (n - 1ll);

        }

        a[i] += n * (n - 1ll - rem);

    }

    cout << 1 << " " << (n - 1ll) << endl;

    f(i, n - 1){

        cout << a[i] * -1ll << " ";

        //a[i] *= -1;

    }

    cout << endl;

    cout << n << " " << n << endl;

    cout << -1ll * a[n - 1] << endl;

	return 0;

}


#include<bits/stdc++.h>
using namespace std;

using ll = long long;

using pii = pair<int, int>;
using pid = pair<int, double>;
using pdd = pair<double, double>;
using pic = pair<int, char>;
using pllll = pair<ll, ll>;
using pllc = pair<ll, char>;
using pill = pair<int, ll>;
using pss = pair<string, string>;
using pis = pair<int, string>;
using plls = pair<ll, string>;
using plld = pair<ll, double>;

using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vs = vector<string>;
using vll = vector<ll>;

#define pb push_back
#define mp make_pair
#define f(i, n) for(int i = 0; i < n; i++)
#define fll(i, n) for(ll i = 0; i < n; i++)
#define F(i, n)	for(int i = 1; i <= n; i++)
#define Fll(i, n) for(ll i = 1; i <= n; i++)
#define fi first
#define se second
#define endl "\n"
#define watch(x) cout << (#x) << " is " << (x) << endl

#define fl fflush(stdout);

int main(){

	//ios::sync_with_stdio(false);

	int n;

    cin >> n;

    vi a(n + 1, 0);

    f(i, n){

        cin >> a[i];

    }

    cout << 1 << " " << n << endl;

    f(i, n){

        ll rem = a[i] % (n - 1ll);
        if(rem < 0){

            rem += (n - 1ll);

        }

        cout << n * (n - 1ll - rem) << " ";

    }

    cout << endl;

    f(i, n){

        ll rem = a[i] % (n - 1ll);
        if(rem < 0){

            rem += (n - 1ll);

        }

        a[i] += n * (n - 1ll - rem);

    }

    cout << 1 << " " << (n - 1ll) << endl;

    f(i, n - 1){

        ll o = a[i] * -1;

        cout << o << " ";

        //a[i] *= -1;

    }

    cout << endl;

    cout << n << " " << n << endl;

    ll out = -1 * a[n - 1];

    cout << out << endl;

	return 0;

}


#include<bits/stdc++.h>
using namespace std;

using ll = long long;

using pii = pair<int, int>;
using pid = pair<int, double>;
using pdd = pair<double, double>;
using pic = pair<int, char>;
using pllll = pair<ll, ll>;
using pllc = pair<ll, char>;
using pill = pair<int, ll>;
using pss = pair<string, string>;
using pis = pair<int, string>;
using plls = pair<ll, string>;
using plld = pair<ll, double>;

using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vs = vector<string>;
using vll = vector<ll>;

#define pb push_back
#define mp make_pair
#define f(i, n) for(int i = 0; i < n; i++)
#define fll(i, n) for(ll i = 0; i < n; i++)
#define F(i, n)	for(int i = 1; i <= n; i++)
#define Fll(i, n) for(ll i = 1; i <= n; i++)
#define fi first
#define se second
#define endl "\n"
#define watch(x) cout << (#x) << " is " << (x) << endl

#define fl fflush(stdout);

int main(){

	//ios::sync_with_stdio(false);

	ll n;

    cin >> n;

    vll a(n + 1, 0);

    f(i, n){

        cin >> a[i];

    }

    cout << 1 << " " << n << endl;

    f(i, n){

        ll rem = a[i] % (n - 1ll);
        if(rem < 0){

            rem += (n - 1ll);

        }

        cout << n * (n - 1ll - rem) << " ";

    }

    cout << endl;

    f(i, n){

        ll rem = a[i] % (n - 1ll);
        if(rem < 0){

            rem += (n - 1ll);

        }

        a[i] += n * (n - 1ll - rem);

    }

    cout << 1 << " " << (n - 1ll) << endl;

    f(i, n - 1){

        cout << a[i] * -1ll << " ";

        //a[i] *= -1;

    }

    cout << endl;

    cout << n << " " << n << endl;

    cout << -1ll * a[n - 1] << endl;

	return 0;

}


#include<bits/stdc++.h>
using namespace std;

using ll = long long;

using pii = pair<int, int>;
using pid = pair<int, double>;
using pdd = pair<double, double>;
using pic = pair<int, char>;
using pllll = pair<ll, ll>;
using pllc = pair<ll, char>;
using pill = pair<int, ll>;
using pss = pair<string, string>;
using pis = pair<int, string>;
using plls = pair<ll, string>;
using plld = pair<ll, double>;

using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vs = vector<string>;
using vll = vector<ll>;

#define pb push_back
#define mp make_pair
#define f(i, n) for(int i = 0; i < n; i++)
#define fll(i, n) for(ll i = 0; i < n; i++)
#define F(i, n)	for(int i = 1; i <= n; i++)
#define Fll(i, n) for(ll i = 1; i <= n; i++)
#define fi first
#define se second
#define endl "\n"
#define watch(x) cout << (#x) << " is " << (x) << endl

#define fl fflush(stdout);

int main(){

	ios::sync_with_stdio(false);

	ll n;

    cin >> n;

    vll a(n + 1, 0);

    Fll(i, n){

        cin >> a[i];

    }

    cout << 1 << " " << n << endl;

    Fll(i, n){

        ll rem = a[i] % (n - 1);
        if(rem < 0){

            rem += (n - 1);

        }

        cout << n * (n - 1 - rem) << " ";

        a[i] += n * (n - 1 - rem);

    }

    cout << endl;

    cout << 1 << " " << n - 1 << endl;

    Fll(i, n - 1){

        cout << a[i] * -1 << " ";

        a[i] *= -1;

    }

    cout << endl;

    cout << n << " " << n << endl;

    cout << -1 * a[n] << endl;

	return 0;

}


#include<bits/stdc++.h>
using namespace std;

using ll = long long;

using pii = pair<int, int>;
using pid = pair<int, double>;
using pdd = pair<double, double>;
using pic = pair<int, char>;
using pllll = pair<ll, ll>;
using pllc = pair<ll, char>;
using pill = pair<int, ll>;
using pss = pair<string, string>;
using pis = pair<int, string>;
using plls = pair<ll, string>;
using plld = pair<ll, double>;

using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vs = vector<string>;
using vll = vector<ll>;

#define pb push_back
#define mp make_pair
#define f(i, n) for(int i = 0; i < n; i++)
#define fll(i, n) for(ll i = 0; i < n; i++)
#define F(i, n)	for(int i = 1; i <= n; i++)
#define Fll(i, n) for(ll i = 1; i <= n; i++)
#define fi first
#define se second
#define endl "\n"
#define watch(x) cout << (#x) << " is " << (x) << endl

#define fl fflush(stdout);

int main(){

	//ios::sync_with_stdio(false);

	ll n;

    cin >> n;

    vll a(n + 1, 0);

    fll(i, n){

        cin >> a[i];

    }

    if(n == 1){

        cout << 1 << " " << 1 << endl;

        cout << -1 * a[0] << endl;

        cout << 1 << " " << 1 << endl;

        cout << 0 << endl;

        cout << 1 << " " << 1 << endl;

        cout << 0 << endl;

    }

    else{cout << 1 << " " << n << endl;

    fll(i, n){

        ll rem = a[i] % (n - 1ll);
        if(rem < 0){

            rem += (n - 1ll);

        }

        cout << n * (n - 1ll - rem) << " ";

    }

    cout << endl;

    fll(i, n){

        ll rem = a[i] % (n - 1ll);
        if(rem < 0){

            rem += (n - 1ll);

        }

        a[i] += n * (n - 1ll - rem);

    }

    cout << 1 << " " << (n - 1ll) << endl;

    fll(i, n - 1){

        ll o = a[i] * -1;

        cout << o << " ";

        //a[i] *= -1;

    }

    cout << endl;

    cout << n << " " << n << endl;

    ll out = -1 * a[n - 1];

    cout << out << endl;}

	return 0;

}


#include<bits/stdc++.h>
using namespace std;

using ll = long long;

using pii = pair<int, int>;
using pid = pair<int, double>;
using pdd = pair<double, double>;
using pic = pair<int, char>;
using pllll = pair<ll, ll>;
using pllc = pair<ll, char>;
using pill = pair<int, ll>;
using pss = pair<string, string>;
using pis = pair<int, string>;
using plls = pair<ll, string>;
using plld = pair<ll, double>;

using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vs = vector<string>;
using vll = vector<ll>;

#define pb push_back
#define mp make_pair
#define f(i, n) for(int i = 0; i < n; i++)
#define fll(i, n) for(ll i = 0; i < n; i++)
#define F(i, n)	for(int i = 1; i <= n; i++)
#define Fll(i, n) for(ll i = 1; i <= n; i++)
#define fi first
#define se second
#define endl "\n"
#define watch(x) cout << (#x) << " is " << (x) << endl

#define fl fflush(stdout);

int main(){

	ios::sync_with_stdio(false);

	ll n;

    cin >> n;

    vll a(n + 1, 0);

    Fll(i, n){

        cin >> a[i];

    }

    cout << 1 << " " << n - 1 << endl;

    Fll(i, n - 1){

        ll rem = a[i] % (n - 1);
        if(rem < 0){

            rem += (n - 1);

        }

        cout << n * (n - 1 - rem) << " ";

        a[i] += n * (n - 1 - rem);

    }

    cout << endl;

    cout << 1 << " " << n - 1 << endl;

    Fll(i, n - 1){

        cout << a[i] * -1 << " ";

        a[i] *= -1;

    }

    cout << endl;

    cout << n << " " << n << endl;

    cout << -1 * a[n] << endl;

	return 0;

}


#include<bits/stdc++.h>
using namespace std;

using ll = long long;

using pii = pair<int, int>;
using pid = pair<int, double>;
using pdd = pair<double, double>;
using pic = pair<int, char>;
using pllll = pair<ll, ll>;
using pllc = pair<ll, char>;
using pill = pair<int, ll>;
using pss = pair<string, string>;
using pis = pair<int, string>;
using plls = pair<ll, string>;
using plld = pair<ll, double>;

using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vs = vector<string>;
using vll = vector<ll>;

#define pb push_back
#define mp make_pair
#define f(i, n) for(int i = 0; i < n; i++)
#define fll(i, n) for(ll i = 0; i < n; i++)
#define F(i, n)	for(int i = 1; i <= n; i++)
#define Fll(i, n) for(ll i = 1; i <= n; i++)
#define fi first
#define se second
#define endl "\n"
#define watch(x) cout << (#x) << " is " << (x) << endl

#define fl fflush(stdout);

int main(){

	//ios::sync_with_stdio(false);

	ll n;

    cin >> n;

    ll a[n];

    f(i, n){

        cin >> a[i];

    }

    cout << 1 << " " << n << endl;

    f(i, n){

        ll rem = a[i] % (n - 1ll);
        if(rem < 0){

            rem += (n - 1ll);

        }

        cout << n * (n - 1ll - rem) << " ";

    }

    cout << endl;

    f(i, n){

        ll rem = a[i] % (n - 1ll);
        if(rem < 0){

            rem += (n - 1ll);

        }

        a[i] += n * (n - 1ll - rem);

    }

    cout << 1 << " " << n - 1ll << endl;

    f(i, n - 1){

        cout << a[i] * -1ll << " ";

        //a[i] *= -1;

    }

    cout << endl;

    cout << n << " " << n << endl;

    cout << -1ll * a[n - 1] << endl;

	return 0;

}


#include<bits/stdc++.h>
using namespace std;

using ll = long long;

using pii = pair<int, int>;
using pid = pair<int, double>;
using pdd = pair<double, double>;
using pic = pair<int, char>;
using pllll = pair<ll, ll>;
using pllc = pair<ll, char>;
using pill = pair<int, ll>;
using pss = pair<string, string>;
using pis = pair<int, string>;
using plls = pair<ll, string>;
using plld = pair<ll, double>;

using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vs = vector<string>;
using vll = vector<ll>;

#define pb push_back
#define mp make_pair
#define f(i, n) for(int i = 0; i < n; i++)
#define fll(i, n) for(ll i = 0; i < n; i++)
#define F(i, n)	for(int i = 1; i <= n; i++)
#define Fll(i, n) for(ll i = 1; i <= n; i++)
#define fi first
#define se second
#define endl "\n"
#define watch(x) cout << (#x) << " is " << (x) << endl

#define fl fflush(stdout);

int main(){

	ios::sync_with_stdio(false);

	ll n;

	cin >> n;

	ll a[n + 1];

	f(i, n){

		cin >> a[i];

	}

	cout << 1 << " " << n << endl;

	f(i, n){

		ll rem = a[i] % (n - 1);

		if(rem < 0){

			rem += (n - 1);

		}

		cout << n * (n - 1 - rem) << " ";

		a[i] += n * (n - 1 - rem);

	}

	cout << endl;

	cout << 1 << " " << n - 1 << endl;

	f(i, n - 1){

		cout << -1 * a[i] << " ";

	}

	cout << endl;

	cout << n << " " << n << endl;

	cout << -1 * a[n - 1] << endl;

	return 0;

}


#include<bits/stdc++.h>
using namespace std;

using ll = long long;

using pii = pair<int, int>;
using pid = pair<int, double>;
using pdd = pair<double, double>;
using pic = pair<int, char>;
using pllll = pair<ll, ll>;
using pllc = pair<ll, char>;
using pill = pair<int, ll>;
using pss = pair<string, string>;
using pis = pair<int, string>;
using plls = pair<ll, string>;
using plld = pair<ll, double>;

using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vs = vector<string>;
using vll = vector<ll>;

#define pb push_back
#define mp make_pair
#define f(i, n) for(int i = 0; i < n; i++)
#define fll(i, n) for(ll i = 0; i < n; i++)
#define F(i, n)	for(int i = 1; i <= n; i++)
#define Fll(i, n) for(ll i = 1; i <= n; i++)
#define fi first
#define se second
#define endl "\n"
#define watch(x) cout << (#x) << " is " << (x) << endl

#define fl fflush(stdout);

int main(){

	ios::sync_with_stdio(false);

	ll n;

    cin >> n;

    vll a(n + 1, 0);

    Fll(i, n){

        cin >> a[i];

    }

    cout << 1 << " " << n << endl;

    Fll(i, n){

        ll rem = a[i] % (n - 1);
        if(rem < 0){

            rem += (n - 1);

        }

        cout << n * (n - 1 - rem) << " ";

        a[i] += n * (n - 1 - rem);

    }

    cout << endl;

    cout << 1 << " " << n - 1 << endl;

    Fll(i, n - 1){

        cout << a[i] * -1 << " ";

        //a[i] *= -1;

    }

    cout << endl;

    cout << n << " " << n << endl;

    cout << -1 * a[n] << endl;

	return 0;

}


/*
power code taken from geeks for geeks
*/
// cout << setprecision (2) << fixed << 1.2;

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef long double ld;

const ll INF = 1e18 + 5;
const ll MAX_N = 1e5 + 5;
const ll MODD = 1e9 + 7;
const ld PI = 3.14159265358979323846;

ll max(ll a,ll b){return a>b?a:b;}
ll min(ll a,ll b){return a<b?a:b;}
double max(double a,double b){return a>b?a:b;}
double min(double a,double b){return a<b?a:b;}

ll modd(ll a){if(a<0LL) return a*-1LL;return a;}
ld modd(ld a){if(a<0.0) return a*-1.0;return a;}

ll modulo(ll a){return (a + MODD) % MODD; }

ll power(ll k, ll p){
    if (p == 0)
        return 1LL;

    ll P = power(k, p/2LL);
    P = (P * P) % MODD;

    if (p % 2 == 1)
        P = (P * k) % MODD;

    return P;
}

struct str_player {
    ll val, idx;
};

ll _lcm(ll a, ll b) {
    return (a * b) / __gcd(a, b);
}

void solve() {
    ll n;
    cin >> n;
    ll a[n];
    for(ll i = 0; i < n; i++) {
        cin >> a[i];
    }

    ll cnt = 0;
    for(ll i = 0; i < n; i++) {
        if(a[i] == 1) {
            cout << i + 1 << " " << i + 1 << "\n-1\n";
        }
        else {

            // cout << "start here: ";

            cout << i + 2 << " " << i + a[i] << endl;

            vector<ll> v;
            v.push_back(-a[i]);
            for(ll j = 0; j < a[i] - 1; j++) {
                ll elem = a[i + j + 1];
                ll lcm = _lcm(a[i], a[i] - 1);
                v.push_back(-1 * lcm);

                cout << lcm - elem << " ";
            }

            cout << endl;

            // cout << "v ";
            // for(ll l: v) {
            //     cout << l << " ";
            // }
            // cout << endl;

            cout << i + 1 << " " << i + a[i] << endl;

            // cout << -a[i] << " ";
            for(ll lcm: v) {
                cout << lcm << " ";
            }
            cout << endl;

            i += a[i] - 1;
        }
        cnt++;
    }

    while(cnt < 2) {
        cout << "1 1\n0\n";
        cnt++;
    }

}

int main(){

    #ifndef ONLINE_JUDGE

    // For getting input from input.txt file
    freopen("input.txt", "r", stdin);

    // Printing the Output to output.txt file
    freopen("output.txt", "w", stdout);
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    ll t=1;

    // cin >> t;

    while(t--){

        solve();
    }

    return 0;
}


/*
power code taken from geeks for geeks
*/
// cout << setprecision (2) << fixed << 1.2;

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef long double ld;

const ll INF = 1e18 + 5;
const ll MAX_N = 1e5 + 5;
const ll MODD = 1e9 + 7;
const ld PI = 3.14159265358979323846;

ll max(ll a,ll b){return a>b?a:b;}
ll min(ll a,ll b){return a<b?a:b;}
double max(double a,double b){return a>b?a:b;}
double min(double a,double b){return a<b?a:b;}

ll modd(ll a){if(a<0LL) return a*-1LL;return a;}
ld modd(ld a){if(a<0.0) return a*-1.0;return a;}

ll modulo(ll a){return (a + MODD) % MODD; }

ll power(ll k, ll p){
    if (p == 0)
        return 1LL;

    ll P = power(k, p/2LL);
    P = (P * P) % MODD;

    if (p % 2 == 1)
        P = (P * k) % MODD;

    return P;
}

struct str_player {
    ll val, idx;
};

ll _lcm(ll a, ll b) {
    return (a * b) / __gcd(a, b);
}

void solve() {
    ll n;
    cin >> n;
    ll a[n];
    for(ll i = 0; i < n; i++) {
        cin >> a[i];
    }

    ll cnt = 0;
    for(ll i = 0; i < n; i++) {
        if(modd(a[i]) == 1) {
            cout << i + 1 << " " << i + 1 << "\n-1\n";
        }
        else if(a[i] == 0) {
            continue;
        }
        else {

            // cout << "start here: ";

            ll len = modd(a[i]);

            cout << i + 2 << " " << i + len << endl;

            vector<ll> v;
            v.push_back(-a[i]);
            // ll len = modd(a[i]);
            ll lcm = _lcm(len, len - 1);
            for(ll j = 0; j < len - 1; j++) {
                // ll elem = a[i + j + 1];
                // ll lcm = _lcm(a[i], a[i] - 1);
                v.push_back(-1 * lcm);

                cout << lcm - a[i + j + 1] << " ";
            }

            cout << endl;

            // cout << "v ";
            // for(ll l: v) {
            //     cout << l << " ";
            // }
            // cout << endl;

            cout << i + 1 << " " << i + len << endl;

            // cout << -a[i] << " ";
            for(ll lcm: v) {
                cout << lcm << " ";
            }
            cout << endl;

            i += len - 1;
            cnt++;
        }
        cnt++;
    }

    while(cnt < 3) {
        cout << "1 1\n0\n";
        cnt++;
    }

}

int main(){

    #ifndef ONLINE_JUDGE

    // For getting input from input.txt file
    freopen("input.txt", "r", stdin);

    // Printing the Output to output.txt file
    freopen("output.txt", "w", stdout);
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    ll t=1;

    // cin >> t;

    while(t--){

        solve();
    }

    return 0;
}


/*
power code taken from geeks for geeks
*/
// cout << setprecision (2) << fixed << 1.2;

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef long double ld;

const ll INF = 1e18 + 5;
const ll MAX_N = 1e5 + 5;
const ll MODD = 1e9 + 7;
const ld PI = 3.14159265358979323846;

ll max(ll a,ll b){return a>b?a:b;}
ll min(ll a,ll b){return a<b?a:b;}
double max(double a,double b){return a>b?a:b;}
double min(double a,double b){return a<b?a:b;}

ll modd(ll a){if(a<0LL) return a*-1LL;return a;}
ld modd(ld a){if(a<0.0) return a*-1.0;return a;}

ll modulo(ll a){return (a + MODD) % MODD; }

ll power(ll k, ll p){
    if (p == 0)
        return 1LL;

    ll P = power(k, p/2LL);
    P = (P * P) % MODD;

    if (p % 2 == 1)
        P = (P * k) % MODD;

    return P;
}

struct str_player {
    ll val, idx;
};

ll _lcm(ll a, ll b) {
    return (a * b) / __gcd(a, b);
}

void solve() {
    ll n;
    cin >> n;
    ll a[n];
    for(ll i = 0; i < n; i++) {
        cin >> a[i];
    }

    ll cnt = 0;
    for(ll i = 0; i < n; i++) {
        if(modd(a[i]) == 1) {
            cout << i + 1 << " " << i + 1 << "\n" << -a[i]  << "\n";
        }
        else if(a[i] == 0) {
            continue;
        }
        else if(modd(a[i]) + i > n) {
            cout << i + 1 << " " << i + 1 << endl << -a[i] << endl;
        }
        else {

            // cout << "start here: ";

            ll len = modd(a[i]);

            cout << i + 2 << " " << i + len << endl;

            vector<ll> v;
            v.push_back(-a[i]);
            // ll len = modd(a[i]);
            ll lcm = _lcm(len, len - 1);
            for(ll j = 0; j < len - 1; j++) {
                // ll elem = a[i + j + 1];
                // ll lcm = _lcm(a[i], a[i] - 1);
                v.push_back(-1 * lcm);

                cout << lcm - a[i + j + 1] << " ";
            }

            cout << endl;

            // cout << "v ";
            // for(ll l: v) {
            //     cout << l << " ";
            // }
            // cout << endl;

            cout << i + 1 << " " << i + len << endl;

            // cout << -a[i] << " ";
            for(ll lcm: v) {
                cout << lcm << " ";
            }
            cout << endl;

            i += len - 1;
            cnt++;
        }
        cnt++;
    }

    while(cnt < 3) {
        cout << "1 1\n0\n";
        cnt++;
    }

}

int main(){

    #ifndef ONLINE_JUDGE

    // For getting input from input.txt file
    freopen("input.txt", "r", stdin);

    // Printing the Output to output.txt file
    freopen("output.txt", "w", stdout);
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    ll t=1;

    // cin >> t;

    while(t--){

        solve();
    }

    return 0;
}


/*
power code taken from geeks for geeks
*/
// cout << setprecision (2) << fixed << 1.2;

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef long double ld;

const ll INF = 1e18 + 5;
const ll MAX_N = 1e5 + 5;
const ll MODD = 1e9 + 7;
const ld PI = 3.14159265358979323846;

ll max(ll a,ll b){return a>b?a:b;}
ll min(ll a,ll b){return a<b?a:b;}
double max(double a,double b){return a>b?a:b;}
double min(double a,double b){return a<b?a:b;}

ll modd(ll a){if(a<0LL) return a*-1LL;return a;}
ld modd(ld a){if(a<0.0) return a*-1.0;return a;}

ll modulo(ll a){return (a + MODD) % MODD; }

ll power(ll k, ll p){
    if (p == 0)
        return 1LL;

    ll P = power(k, p/2LL);
    P = (P * P) % MODD;

    if (p % 2 == 1)
        P = (P * k) % MODD;

    return P;
}

struct str_player {
    ll val, idx;
};

ll _lcm(ll a, ll b) {
    return (a * b) / __gcd(a, b);
}

void solve() {
    ll n;
    cin >> n;
    ll a[n];
    for(ll i = 0; i < n; i++) {
        cin >> a[i];
    }

    ll cnt = 0;
    for(ll i = 0; i < n; i++) {
        if(a[i] == 1) {
            cout << i + 1 << " " << i + 1 << "\n-1\n";
        }
        else if(a[i] == 0) {
            continue;
        }
        else {

            // cout << "start here: ";

            ll len = modd(a[i]);

            cout << i + 2 << " " << i + len << endl;

            vector<ll> v;
            v.push_back(-a[i]);
            // ll len = modd(a[i]);
            ll lcm = _lcm(len, len - 1);
            for(ll j = 0; j < len - 1; j++) {
                // ll elem = a[i + j + 1];
                // ll lcm = _lcm(a[i], a[i] - 1);
                v.push_back(-1 * lcm);

                cout << lcm - a[i + j + 1] << " ";
            }

            cout << endl;

            // cout << "v ";
            // for(ll l: v) {
            //     cout << l << " ";
            // }
            // cout << endl;

            cout << i + 1 << " " << i + len << endl;

            // cout << -a[i] << " ";
            for(ll lcm: v) {
                cout << lcm << " ";
            }
            cout << endl;

            i += len - 1;
            cnt++;
        }
        cnt++;
    }

    while(cnt < 3) {
        cout << "1 1\n0\n";
        cnt++;
    }

}

int main(){

    #ifndef ONLINE_JUDGE

    // For getting input from input.txt file
    freopen("input.txt", "r", stdin);

    // Printing the Output to output.txt file
    freopen("output.txt", "w", stdout);
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    ll t=1;

    // cin >> t;

    while(t--){

        solve();
    }

    return 0;
}


/*
power code taken from geeks for geeks
*/
// cout << setprecision (2) << fixed << 1.2;

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef long double ld;

const ll INF = 1e18 + 5;
const ll MAX_N = 1e5 + 5;
const ll MODD = 1e9 + 7;
const ld PI = 3.14159265358979323846;

ll max(ll a,ll b){return a>b?a:b;}
ll min(ll a,ll b){return a<b?a:b;}
double max(double a,double b){return a>b?a:b;}
double min(double a,double b){return a<b?a:b;}

ll modd(ll a){if(a<0LL) return a*-1LL;return a;}
ld modd(ld a){if(a<0.0) return a*-1.0;return a;}

ll modulo(ll a){return (a + MODD) % MODD; }

ll power(ll k, ll p){
    if (p == 0)
        return 1LL;

    ll P = power(k, p/2LL);
    P = (P * P) % MODD;

    if (p % 2 == 1)
        P = (P * k) % MODD;

    return P;
}

struct str_player {
    ll val, idx;
};

ll _lcm(ll a, ll b) {
    return (a * b) / __gcd(a, b);
}

void solve() {
    ll n;
    cin >> n;
    ll a[n];
    for(ll i = 0; i < n; i++) {
        cin >> a[i];
    }

    ll cnt = 0;
    for(ll i = 0; i < n; i++) {
        if(a[i] == 1) {
            cout << i + 1 << " " << i + 1 << "\n-1\n";
        }
        else {

            // cout << "start here: ";

            cout << i + 2 << " " << i + a[i] << endl;

            vector<ll> v;
            v.push_back(-a[i]);
            for(ll j = 0; j < a[i] - 1; j++) {
                ll elem = a[i + j + 1];
                ll lcm = _lcm(a[i], a[i] - 1);
                v.push_back(-1 * lcm);

                cout << lcm - elem << " ";
            }

            cout << endl;

            // cout << "v ";
            // for(ll l: v) {
            //     cout << l << " ";
            // }
            // cout << endl;

            cout << i + 1 << " " << i + a[i] << endl;

            // cout << -a[i] << " ";
            for(ll lcm: v) {
                cout << lcm << " ";
            }
            cout << endl;

            i += a[i] - 1;
            cnt++;
        }
        cnt++;
    }

    while(cnt < 3) {
        cout << "1 1\n0\n";
        cnt++;
    }

}

int main(){

    #ifndef ONLINE_JUDGE

    // For getting input from input.txt file
    freopen("input.txt", "r", stdin);

    // Printing the Output to output.txt file
    freopen("output.txt", "w", stdout);
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    ll t=1;

    // cin >> t;

    while(t--){

        solve();
    }

    return 0;
}


/*
power code taken from geeks for geeks
*/
// cout << setprecision (2) << fixed << 1.2;

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef long double ld;

const ll INF = 1e18 + 5;
const ll MAX_N = 1e5 + 5;
const ll MODD = 1e9 + 7;
const ld PI = 3.14159265358979323846;

ll max(ll a,ll b){return a>b?a:b;}
ll min(ll a,ll b){return a<b?a:b;}
double max(double a,double b){return a>b?a:b;}
double min(double a,double b){return a<b?a:b;}

ll modd(ll a){if(a<0LL) return a*-1LL;return a;}
ld modd(ld a){if(a<0.0) return a*-1.0;return a;}

ll modulo(ll a){return (a + MODD) % MODD; }

ll power(ll k, ll p){
    if (p == 0)
        return 1LL;

    ll P = power(k, p/2LL);
    P = (P * P) % MODD;

    if (p % 2 == 1)
        P = (P * k) % MODD;

    return P;
}

struct str_player {
    ll val, idx;
};

ll _lcm(ll a, ll b) {
    return (a * b) / __gcd(a, b);
}

void solve() {
    ll n;
    cin >> n;
    ll a[n];
    for(ll i = 0; i < n; i++) {
        cin >> a[i];
    }

    for(ll i = 0; i < n; i++) {
        if(a[i] == 1) {
            cout << i + 1 << " " << i + 1 << "\n-1\n";
        }
        else {

            // cout << "start here: ";

            cout << i + 2 << " " << i + a[i] << endl;

            vector<ll> v;
            v.push_back(-a[i]);
            for(ll j = 0; j < a[i] - 1; j++) {
                ll elem = a[i + j + 1];
                ll lcm = _lcm(a[i], a[i] - 1);
                v.push_back(-1 * lcm);

                cout << lcm - elem << " ";
            }

            cout << endl;

            // cout << "v ";
            // for(ll l: v) {
            //     cout << l << " ";
            // }
            // cout << endl;

            cout << i + 1 << " " << i + a[i] << endl;

            // cout << -a[i] << " ";
            for(ll lcm: v) {
                cout << lcm << " ";
            }
            cout << endl;

            i += a[i] - 1;
        }
    }

}

int main(){

    #ifndef ONLINE_JUDGE

    // For getting input from input.txt file
    freopen("input.txt", "r", stdin);

    // Printing the Output to output.txt file
    freopen("output.txt", "w", stdout);
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    ll t=1;

    // cin >> t;

    while(t--){

        solve();
    }

    return 0;
}


/*
power code taken from geeks for geeks
*/
// cout << setprecision (2) << fixed << 1.2;

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef long double ld;

const ll INF = 1e18 + 5;
const ll MAX_N = 1e5 + 5;
const ll MODD = 1e9 + 7;
const ld PI = 3.14159265358979323846;

ll max(ll a,ll b){return a>b?a:b;}
ll min(ll a,ll b){return a<b?a:b;}
double max(double a,double b){return a>b?a:b;}
double min(double a,double b){return a<b?a:b;}

ll modd(ll a){if(a<0LL) return a*-1LL;return a;}
ld modd(ld a){if(a<0.0) return a*-1.0;return a;}

ll modulo(ll a){return (a + MODD) % MODD; }

ll power(ll k, ll p){
    if (p == 0)
        return 1LL;

    ll P = power(k, p/2LL);
    P = (P * P) % MODD;

    if (p % 2 == 1)
        P = (P * k) % MODD;

    return P;
}

struct str_player {
    ll val, idx;
};

ll _lcm(ll a, ll b) {
    return (a * b) / __gcd(a, b);
}

void solve() {
    ll n;
    cin >> n;
    ll a[n];
    for(ll i = 0; i < n; i++) {
        cin >> a[i];
    }

    ll cnt = 0;
    for(ll i = 0; i < n; i++) {
        if(modd(a[i]) == 1) {
            cout << i + 1 << " " << i + 1 << "\n" << -a[i]  << "\n";
        }
        else if(a[i] == 0) {
            continue;
        }
        else if(modd(a[i]) + i >= n) {
            cout << i + 1 << " " << i + 1 << endl << -a[i] << endl;
        }
        else {

            // cout << "start here: ";

            ll len = modd(a[i]);

            cout << i + 2 << " " << i + len << endl;

            vector<ll> v;
            v.push_back(-a[i]);
            // ll len = modd(a[i]);
            ll lcm = _lcm(len, len - 1);
            for(ll j = 0; j < len - 1; j++) {
                // ll elem = a[i + j + 1];
                // ll lcm = _lcm(a[i], a[i] - 1);
                v.push_back(-1 * lcm);

                cout << lcm - a[i + j + 1] << " ";
            }

            cout << endl;

            // cout << "v ";
            // for(ll l: v) {
            //     cout << l << " ";
            // }
            // cout << endl;

            cout << i + 1 << " " << i + len << endl;

            // cout << -a[i] << " ";
            for(ll lcm: v) {
                cout << lcm << " ";
            }
            cout << endl;

            i += len - 1;
            cnt++;
        }
        cnt++;
    }

    while(cnt < 3) {
        cout << "1 1\n0\n";
        cnt++;
    }

}

int main(){

    #ifndef ONLINE_JUDGE

    // For getting input from input.txt file
    freopen("input.txt", "r", stdin);

    // Printing the Output to output.txt file
    freopen("output.txt", "w", stdout);
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    ll t=1;

    // cin >> t;

    while(t--){

        solve();
    }

    return 0;
}


/*
power code taken from geeks for geeks
*/
// cout << setprecision (2) << fixed << 1.2;

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef long double ld;

const ll INF = 1e18 + 5;
const ll MAX_N = 1e5 + 5;
const ll MODD = 1e9 + 7;
const ld PI = 3.14159265358979323846;

ll max(ll a,ll b){return a>b?a:b;}
ll min(ll a,ll b){return a<b?a:b;}
double max(double a,double b){return a>b?a:b;}
double min(double a,double b){return a<b?a:b;}

ll modd(ll a){if(a<0LL) return a*-1LL;return a;}
ld modd(ld a){if(a<0.0) return a*-1.0;return a;}

ll modulo(ll a){return (a + MODD) % MODD; }

ll power(ll k, ll p){
    if (p == 0)
        return 1LL;

    ll P = power(k, p/2LL);
    P = (P * P) % MODD;

    if (p % 2 == 1)
        P = (P * k) % MODD;

    return P;
}

struct str_player {
    ll val, idx;
};

ll _lcm(ll a, ll b) {
    return (a * b) / __gcd(a, b);
}

void solve() {
    ll n;
    cin >> n;
    ll a[n];
    for(ll i = 0; i < n; i++) {
        cin >> a[i];
    }

    for(ll i = 0; i < n; i++) {
        if(a[i] == 1) {
            cout << "1 1\n-1\n";
        }
        else {

            // cout << "start here: ";

            cout << i + 2 << " " << i + a[i] << endl;

            vector<ll> v;
            v.push_back(-a[i]);
            for(ll j = 0; j < a[i] - 1; j++) {
                ll elem = a[i + j + 1];
                ll lcm = _lcm(a[i], a[i] - 1);
                v.push_back(-1 * lcm);

                cout << lcm - elem << " ";
            }

            cout << endl;

            // cout << "v ";
            // for(ll l: v) {
            //     cout << l << " ";
            // }
            // cout << endl;

            cout << i + 1 << " " << i + a[i] << endl;

            // cout << -a[i] << " ";
            for(ll lcm: v) {
                cout << lcm << " ";
            }
            cout << endl;

            i += a[i] - 1;
        }
    }

}

int main(){

    #ifndef ONLINE_JUDGE

    // For getting input from input.txt file
    freopen("input.txt", "r", stdin);

    // Printing the Output to output.txt file
    freopen("output.txt", "w", stdout);
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    ll t=1;

    // cin >> t;

    while(t--){

        solve();
    }

    return 0;
}


/*
power code taken from geeks for geeks
*/
// cout << setprecision (2) << fixed << 1.2;

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef long double ld;

const ll INF = 1e18 + 5;
const ll MAX_N = 1e5 + 5;
const ll MODD = 1e9 + 7;
const ld PI = 3.14159265358979323846;

ll max(ll a,ll b){return a>b?a:b;}
ll min(ll a,ll b){return a<b?a:b;}
double max(double a,double b){return a>b?a:b;}
double min(double a,double b){return a<b?a:b;}

ll modd(ll a){if(a<0LL) return a*-1LL;return a;}
ld modd(ld a){if(a<0.0) return a*-1.0;return a;}

ll modulo(ll a){return (a + MODD) % MODD; }

ll power(ll k, ll p){
    if (p == 0)
        return 1LL;

    ll P = power(k, p/2LL);
    P = (P * P) % MODD;

    if (p % 2 == 1)
        P = (P * k) % MODD;

    return P;
}

struct str_player {
    ll val, idx;
};

ll _lcm(ll a, ll b) {
    return (a * b) / __gcd(a, b);
}

void solve() {
    ll n;
    cin >> n;
    ll a[n];
    for(ll i = 0; i < n; i++) {
        cin >> a[i];
    }

    ll cnt = 0;
    for(ll i = 0; i < n; i++) {
        if(a[i] == 1) {
            cout << i + 1 << " " << i + 1 << "\n-1\n";
        }
        else if(a[i] == 0) {
            continue;
        }
        else {

            // cout << "start here: ";

            cout << i + 2 << " " << i + a[i] << endl;

            vector<ll> v;
            v.push_back(-a[i]);
            ll len = modd(a[i]);
            ll lcm = _lcm(len, len - 1);
            for(ll j = 0; j < len - 1; j++) {
                // ll elem = a[i + j + 1];
                // ll lcm = _lcm(a[i], a[i] - 1);
                v.push_back(-1 * lcm);

                cout << lcm - a[i + j + 1] << " ";
            }

            cout << endl;

            // cout << "v ";
            // for(ll l: v) {
            //     cout << l << " ";
            // }
            // cout << endl;

            cout << i + 1 << " " << i + a[i] << endl;

            // cout << -a[i] << " ";
            for(ll lcm: v) {
                cout << lcm << " ";
            }
            cout << endl;

            i += a[i] - 1;
            cnt++;
        }
        cnt++;
    }

    while(cnt < 3) {
        cout << "1 1\n0\n";
        cnt++;
    }

}

int main(){

    #ifndef ONLINE_JUDGE

    // For getting input from input.txt file
    freopen("input.txt", "r", stdin);

    // Printing the Output to output.txt file
    freopen("output.txt", "w", stdout);
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    ll t=1;

    // cin >> t;

    while(t--){

        solve();
    }

    return 0;
}


/*
power code taken from geeks for geeks
*/
// cout << setprecision (2) << fixed << 1.2;

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef long double ld;

const ll INF = 1e18 + 5;
const ll MAX_N = 1e5 + 5;
const ll MODD = 1e9 + 7;
const ld PI = 3.14159265358979323846;

ll max(ll a,ll b){return a>b?a:b;}
ll min(ll a,ll b){return a<b?a:b;}
double max(double a,double b){return a>b?a:b;}
double min(double a,double b){return a<b?a:b;}

ll modd(ll a){if(a<0LL) return a*-1LL;return a;}
ld modd(ld a){if(a<0.0) return a*-1.0;return a;}

ll modulo(ll a){return (a + MODD) % MODD; }

ll power(ll k, ll p){
    if (p == 0)
        return 1LL;

    ll P = power(k, p/2LL);
    P = (P * P) % MODD;

    if (p % 2 == 1)
        P = (P * k) % MODD;

    return P;
}

struct str_player {
    ll val, idx;
};

void solve() {
    ll n;
    cin >> n;
    ll a[n];
    for(ll i = 0; i < n; i++) {
        cin >> a[i];
    }

    cout << "1 1\n" << -a[0] << endl;
    if(n == 1) {
        cout << "1 1\n" << "0\n";
        cout << "1 1\n" << "0\n";
        return;
    }
    cout << "2 " << n << endl;
    for(ll i = 1; i < n; i++) {
        cout << (n - 1) * a[i] << " ";
    }
    cout << endl;
    cout << "1 " << n << endl;
    cout << 0 << " ";
    for(ll i = 1; i < n; i++) {
        cout << n * a[i] * -1 << " ";
    }
    cout << endl;

}

int main(){

    #ifndef ONLINE_JUDGE

    // For getting input from input.txt file
    freopen("input.txt", "r", stdin);

    // Printing the Output to output.txt file
    freopen("output.txt", "w", stdout);
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    ll t=1;

    // cin >> t;

    while(t--){

        solve();
    }

    return 0;
}


/*
power code taken from geeks for geeks
*/
// cout << setprecision (2) << fixed << 1.2;

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef long double ld;

const ll INF = 1e18 + 5;
const ll MAX_N = 1e5 + 5;
const ll MODD = 1e9 + 7;
const ld PI = 3.14159265358979323846;

ll max(ll a,ll b){return a>b?a:b;}
ll min(ll a,ll b){return a<b?a:b;}
double max(double a,double b){return a>b?a:b;}
double min(double a,double b){return a<b?a:b;}

ll modd(ll a){if(a<0LL) return a*-1LL;return a;}
ld modd(ld a){if(a<0.0) return a*-1.0;return a;}

ll modulo(ll a){return (a + MODD) % MODD; }

ll power(ll k, ll p){
    if (p == 0)
        return 1LL;

    ll P = power(k, p/2LL);
    P = (P * P) % MODD;

    if (p % 2 == 1)
        P = (P * k) % MODD;

    return P;
}

struct str_player {
    ll val, idx;
};

ll _lcm(ll a, ll b) {
    return (a * b) / __gcd(a, b);
}

void solve() {
    ll n;
    cin >> n;
    ll a[n];
    for(ll i = 0; i < n; i++) {
        cin >> a[i];
    }

    ll cnt = 0;
    for(ll i = 0; i < n; i++) {
        if(modd(a[i]) == 1) {
            cout << i + 1 << " " << i + 1 << "\n" << -a[i]  << "\n";
        }
        else if(a[i] == 0) {
            continue;
        }
        else {

            // cout << "start here: ";

            ll len = modd(a[i]);

            cout << i + 2 << " " << i + len << endl;

            vector<ll> v;
            v.push_back(-a[i]);
            // ll len = modd(a[i]);
            ll lcm = _lcm(len, len - 1);
            for(ll j = 0; j < len - 1; j++) {
                // ll elem = a[i + j + 1];
                // ll lcm = _lcm(a[i], a[i] - 1);
                v.push_back(-1 * lcm);

                cout << lcm - a[i + j + 1] << " ";
            }

            cout << endl;

            // cout << "v ";
            // for(ll l: v) {
            //     cout << l << " ";
            // }
            // cout << endl;

            cout << i + 1 << " " << i + len << endl;

            // cout << -a[i] << " ";
            for(ll lcm: v) {
                cout << lcm << " ";
            }
            cout << endl;

            i += len - 1;
            cnt++;
        }
        cnt++;
    }

    while(cnt < 3) {
        cout << "1 1\n0\n";
        cnt++;
    }

}

int main(){

    #ifndef ONLINE_JUDGE

    // For getting input from input.txt file
    freopen("input.txt", "r", stdin);

    // Printing the Output to output.txt file
    freopen("output.txt", "w", stdout);
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    ll t=1;

    // cin >> t;

    while(t--){

        solve();
    }

    return 0;
}


/*
power code taken from geeks for geeks
*/
// cout << setprecision (2) << fixed << 1.2;

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef long double ld;

const ll INF = 1e18 + 5;
const ll MAX_N = 1e5 + 5;
const ll MODD = 1e9 + 7;
const ld PI = 3.14159265358979323846;

ll max(ll a,ll b){return a>b?a:b;}
ll min(ll a,ll b){return a<b?a:b;}
double max(double a,double b){return a>b?a:b;}
double min(double a,double b){return a<b?a:b;}

ll modd(ll a){if(a<0LL) return a*-1LL;return a;}
ld modd(ld a){if(a<0.0) return a*-1.0;return a;}

ll modulo(ll a){return (a + MODD) % MODD; }

ll power(ll k, ll p){
    if (p == 0)
        return 1LL;

    ll P = power(k, p/2LL);
    P = (P * P) % MODD;

    if (p % 2 == 1)
        P = (P * k) % MODD;

    return P;
}

struct str_player {
    ll val, idx;
};

void solve() {
    ll n;
    cin >> n;
    ll a[n];
    for(ll i = 0; i < n; i++) {
        cin >> a[i];
    }

    cout << "1 1\n" << -a[0] << endl;
    if(n == 1) {
        cout << "1 1\n" << "0\n";
        cout << "1 1\n" << "0\n";
        return;
    }
    cout << "2 " << n + 1 << endl;
    for(ll i = 1; i < n; i++) {
        cout << (n - 1) * a[i] << " ";
    }
    cout << endl;
    cout << "1 " << n << endl;
    for(ll i = 0; i < n; i++) {
        cout << n * a[i] * -1 << " ";
    }
    cout << endl;

}

int main(){

    #ifndef ONLINE_JUDGE

    // For getting input from input.txt file
    freopen("input.txt", "r", stdin);

    // Printing the Output to output.txt file
    freopen("output.txt", "w", stdout);
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    ll t=1;

    // cin >> t;

    while(t--){

        solve();
    }

    return 0;
}


/*
power code taken from geeks for geeks
*/
// cout << setprecision (2) << fixed << 1.2;

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef long double ld;

const ll INF = 1e18 + 5;
const ll MAX_N = 1e5 + 5;
const ll MODD = 1e9 + 7;
const ld PI = 3.14159265358979323846;

ll max(ll a,ll b){return a>b?a:b;}
ll min(ll a,ll b){return a<b?a:b;}
double max(double a,double b){return a>b?a:b;}
double min(double a,double b){return a<b?a:b;}

ll modd(ll a){if(a<0LL) return a*-1LL;return a;}
ld modd(ld a){if(a<0.0) return a*-1.0;return a;}

ll modulo(ll a){return (a + MODD) % MODD; }

ll power(ll k, ll p){
    if (p == 0)
        return 1LL;

    ll P = power(k, p/2LL);
    P = (P * P) % MODD;

    if (p % 2 == 1)
        P = (P * k) % MODD;

    return P;
}

struct str_player {
    ll val, idx;
};

void solve() {
    ll n;
    cin >> n;
    ll a[n];
    for(ll i = 0; i < n; i++) {
        cin >> a[i];
    }

    cout << "1 1\n" << -a[0] << endl;
    if(n == 1) {
        cout << "1 1\n" << "0\n";
        cout << "1 1\n" << "0\n";
        return;
    }
    cout << "2 " << n << endl;
    for(ll i = 1; i < n; i++) {
        cout << (n - 1) * a[i] << " ";
    }
    cout << endl;
    cout << "1 " << n << endl;
    for(ll i = 0; i < n; i++) {
        cout << n * a[i] * -1 << " ";
    }
    cout << endl;

}

int main(){

    #ifndef ONLINE_JUDGE

    // For getting input from input.txt file
    freopen("input.txt", "r", stdin);

    // Printing the Output to output.txt file
    freopen("output.txt", "w", stdout);
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    ll t=1;

    // cin >> t;

    while(t--){

        solve();
    }

    return 0;
}


#include <bits/stdc++.h>

	using namespace std;

int a[200000];
	int main(){
   // int t;
    //cin>>t;

int n;
cin>>n;
for(int i=0;i<n;i++)
    cin>>a[i];
if(n==1){

        cout<<1<<' '<<1;
        cout<<endl;
        cout<<-a[0]<<endl;
        cout<<1<<' '<<1;
        cout<<endl;
        cout<<0;
        cout<<endl;
        cout<<1<<' '<<1;
        cout<<endl;
        cout<<0;

}
else{

    cout<<1<<" "<<n<<endl;
for(int i=0;i<n;i++){
    cout<<(n-1-a[i])*n<<" ";
    a[i]+=(n-1-a[i])*n;
}
cout<<endl;
for(int i=0;i<n-1;i++)
    cout<<-a[i]<<" ";

cout<<endl<<-a[0];}
	}


#include<bits/stdc++.h>
using namespace std;
long long a[100005];
int main()
{
    int n;
    cin>>n;
    for (int i=0;i<n;i++) cin>>a[i];
    cout<<1<<" "<<n-1<<endl;
    for (int i=0;i<n-1;i++){
        long long temp=a[i]%n;
        cout<<((temp)%n+n)*(n-1)<<" ";
        a[i]+=((temp)%n+n)*(n-1);
    }
    cout<<endl;
    cout<<n<<" "<<n<<endl;
    cout<<a[n]%n+n<<endl;
    a[n]+=a[n]%n+n;
    cout<<1<<" "<<n<<endl;
    for (int i=0;i<n;i++){
        cout<<-a[i]<<" ";
    }
    cout<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long a[100005];
int main()
{
    int n;
    cin>>n;
    for (int i=0;i<n;i++) cin>>a[i];
    if (n==1){
        cout<<1<<" "<<1<<endl;
        cout<<1<<endl;
         cout<<1<<" "<<1<<endl;
        cout<<1<<endl;
         cout<<1<<" "<<1<<endl;
        cout<<-a[0]-2<<endl;
    }
    else{

    cout<<1<<" "<<n-1<<endl;
    for (int i=0;i<n-1;i++){
        long long temp=a[i]%n;
        cout<<((temp)%n+n)*(n-1)<<" ";
        a[i]+=((temp)%n+n)*(n-1);
    }
    cout<<endl;
    cout<<n<<" "<<n<<endl;
    cout<<-a[n-1]%n<<endl;

    a[n-1]+=a[n-1]%n+n;
    cout<<1<<" "<<n<<endl;
    for (int i=0;i<n;i++){
        cout<<-a[i]<<" ";
        if (a[i]%n==0) cout<<1<<endl;
    }
    cout<<endl;

    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long a[100005];
int main()
{
    int n;
    cin>>n;
    for (int i=0;i<n;i++) cin>>a[i];
    if (n==1){
        cout<<1<<" "<<1<<endl;
        cout<<1<<endl;
         cout<<1<<" "<<1<<endl;
        cout<<1<<endl;
         cout<<1<<" "<<1<<endl;
        cout<<-a[0]-2<<endl;
    }
    else{

    cout<<1<<" "<<n-1<<endl;
    for (int i=0;i<n-1;i++){
        long long temp=a[i]%n;
        cout<<((temp)%n+n)*(n-1)<<" ";
        a[i]+=((temp)%n+n)*(n-1);
    }
    cout<<endl;
    cout<<n<<" "<<n<<endl;
    cout<<-a[n-1]%n<<endl;

    a[n-1]+=-a[n-1]%n;
    cout<<1<<" "<<n<<endl;
    for (int i=0;i<n;i++){
        cout<<-a[i]<<" ";
        if (a[i]%n==0) cout<<1<<endl;
    }
    cout<<endl;

    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long a[100005];
int main()
{
    int n;
    cin>>n;
    for (int i=0;i<n;i++) cin>>a[i];
    if (n==1){
        cout<<1<<" "<<1<<endl;
        cout<<1<<endl;
         cout<<1<<" "<<1<<endl;
        cout<<1<<endl;
         cout<<1<<" "<<1<<endl;
        cout<<-a[0]-2<<endl;
    }
    else{

    cout<<1<<" "<<n-1<<endl;
    for (int i=0;i<n-1;i++){
        long long temp=a[i]%n;
        cout<<((temp)%n+n)*(n-1)<<" ";
        a[i]+=((temp)%n+n)*(n-1);
    }
    cout<<endl;
    cout<<n<<" "<<n<<endl;
    cout<<a[n-1]%n+n<<endl;
    a[n-1]+=a[n-1]%n+n;
    cout<<1<<" "<<n<<endl;
    for (int i=0;i<n;i++){
        cout<<-a[i]<<" ";
    }
    cout<<endl;
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long a[100005];
int main()
{
int n;
cin>>n;
for (int i=0;i<n;i++) cin>>a[i];
if (n==1){
cout<<1<<" "<<1<<endl;
cout<<1<<endl;
cout<<1<<" "<<1<<endl;
cout<<1<<endl;
cout<<1<<" "<<1<<endl;
cout<<-a[0]-2<<endl;
}
else{
cout<<1<<" "<<n-1<<endl;
for (int i=0;i<n-1;i++){
long long temp=a[i]%n;
cout<<((temp)%n+n)*(n-1)<<" ";
a[i]+=((temp)%n+n)*(n-1);
}
cout<<endl;
cout<<n<<" "<<n<<endl;
cout<<-a[n-1]%n<<endl;
a[n-1]+=-a[n-1]%n;
cout<<1<<" "<<n<<endl;
for (int i=0;i<n;i++){
cout<<-a[i]<<" ";
//if (a[i]%n==0) cout<<1<<endl;
}
cout<<endl;
}
return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long a[100005];
int main()
{
    int n;
    cin>>n;
    if (n==1){
        cout<<1<<" "<<1<<endl;
        cout<<1<<endl;
         cout<<1<<" "<<1<<endl;
        cout<<1<<endl;
         cout<<1<<" "<<1<<endl;
        cout<<-a[0]-2<<endl;
    }
    else{

    for (int i=0;i<n;i++) cin>>a[i];
    cout<<1<<" "<<n-1<<endl;
    for (int i=0;i<n-1;i++){
        long long temp=a[i]%n;
        cout<<((temp)%n+n)*(n-1)<<" ";
        a[i]+=((temp)%n+n)*(n-1);
    }
    cout<<endl;
    cout<<n<<" "<<n<<endl;
    cout<<a[n-1]%n+n<<endl;
    a[n-1]+=a[n-1]%n+n;
    cout<<1<<" "<<n<<endl;
    for (int i=0;i<n;i++){
        cout<<-a[i]<<" ";
    }
    cout<<endl;
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long a[100005];
int main()
{
int n;
cin>>n;
for (int i=0;i<n;i++) cin>>a[i];
if (n==1){
cout<<1<<" "<<1<<endl;
cout<<1<<endl;
cout<<1<<" "<<1<<endl;
cout<<1<<endl;
cout<<1<<" "<<1<<endl;
cout<<-a[0]-2<<endl;
}
else{
cout<<1<<" "<<n-1<<endl;
for (int i=0;i<n-1;i++){
long long temp=a[i]%n;
cout<<((temp)%n+n)*(n-1)<<" ";
a[i]+=((temp)%n+n)*(n-1);
}
cout<<endl;
cout<<n<<" "<<n<<endl;
cout<<-a[n-1]%n<<endl;
a[n-1]+=-a[n-1]%n;
//cout<<1<<" "<<n<<endl;
for (int i=0;i<n;i++){
cout<<-a[i]<<" ";
if (a[i]%n==0) cout<<1<<endl;
}
cout<<endl;
}
return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long a[100005];
int main()
{
    int n;
    cin>>n;
    for (int i=0;i<n;i++) cin>>a[i];
    cout<<1<<" "<<n-1<<endl;
    for (int i=0;i<n-1;i++){
        long long temp=a[i]%n;
        cout<<((temp)%n+n)*(n-1)<<" ";
        a[i]+=((temp)%n+n)*(n-1);
    }
    cout<<endl;
    cout<<n<<" "<<n<<endl;
    cout<<a[n-1]%n+n<<endl;
    a[n-1]+=a[n-1]%n+n;
    cout<<1<<" "<<n<<endl;
    for (int i=0;i<n;i++){
        cout<<-a[i]<<" ";
    }
    cout<<endl;
    return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <deque>
#include <string>
#include <map>

using namespace std;
#define LLMIN LONG_LONG_MIN
#define LLMAX LONG_LONG_MAX
#define IMIN INT_MIN
#define IMAX INT_MAX
#define ff first
#define ss second
#define pb push_back
#define all(a) a.begin(),a.end()
#define rep(i,a,b) for(auto i=(a); i<(b); i++)
#define dec(i,n,a) for(auto i=(n); i>=(a); i--)
constexpr auto nl = '\n';
#define sz(s) s.size()
template<typename T>
constexpr auto len(T s) { return s.length(); }
#define inp(a) for(auto& i: a) cin >> i
#define prt(a) for(auto& i: a) cout << i << ' '
#define _ auto
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl

#define inc int t_; cin >> t_; while(t_--)
typedef int64_t ll;
typedef uint64_t ull;
typedef vector<bool> vb;
typedef map<int, int> mii;
typedef map<string, int> msi;
typedef pair<int32_t, int32_t> pii;
typedef pair<ll, ll> pll;
typedef vector<int32_t> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<vector<int32_t>> vvi;
typedef vector<vector<ll>> vvll;
typedef vector<vector<string>> vvs;
//#define _DEBUG

void solve() {

}

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifdef _DEBUG
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
#endif

	//inc solve();
	ll n; cin >> n;
	vll a(n);
	inp(a);
	if (n == 1) {
		cout << 1 << ' ' << 1;
		cout << 0 << nl;
		cout << 1 << ' ' << 1;
		cout << 0 << nl;
		cout << 1 << ' ' << 1;
		cout << a[0] << nl;
		return 0;
	}
	cout << 1 << ' ' << n - 1 << nl;
	for (ll i = 0; i < n-1; i++)
	{

		cout << (n - 1) * (((a[i] % a.size()) + a.size()) % a.size()) << ' ';
		a[i] += (n - 1) * (((a[i] % a.size()) + a.size()) % a.size());

	}
	cout << nl;
	cout << 1 << ' ' << n << nl;
	for (ll i = 0; i < n; i++)
	{
		cout << (n) * (((a[i] % a.size()) + a.size()) % a.size()) << ' ';
		a[i] += (n) * (((a[i] % a.size()) + a.size()) % a.size());
	}
	cout << nl;
	cout << 1 << ' ' << n << nl;
	for (ll i = 0; i < n; i++)
	{
		cout << a[i] << ' ';
		//if (a[i] % n != 0) cout << "fail" << nl;
	}

	//int n; cin >> n;
	//vi a(n); inp(a);
	//vi ans(n);
	//vi not_used;
	//// 1e5
	//for (int i = 0; i < n; i++) {
	//	// нахождение делителей за Log 1e9
	//	int tmp = a[i];
	//	int del = 2;
	//	map<int, int> mp;
	//	while (tmp != 1) {
	//		int c = 0;
	//		while (tmp % del == 0) {
	//			c++;
	//			tmp /= del;
	//		}
	//		mp[c]++;
	//		del++;
	//	}
	//	bool st = true;
	//	int eq = (*mp.begin()).second;
	//	for (auto i: mp) {
	//		if (eq != i.second) {
	//			st = false; break;
	//		}
	//	}
	//	if (st) ans[eq]++;
	//	else not_used.push_back(i);
	//}

}


#include <stdio.h>
#include <string.h>
#include <algorithm>
using namespace std;
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
const int maxn=1e6;

struct data{
    long long v,t,p;
}b[maxn];

int a[26];
int cnt[26];
int pos[26][maxn];
char s[maxn];
long long sum[maxn];

bool cmp(data x,data y)
{
    return x.v<y.v;
}

int main()
{
    memset(sum,0,sizeof(sum));
    memset(pos,0,sizeof(pos));
    int i,j,m,n;
    for(i=0;i<26;i++)  scanf("%d",&a[i]);
    scanf("%s",s);
    int len=strlen(s);
    for(i=0;i<len;i++)
    {
        if(i==0)
            sum[i]=a[s[i]-'a'];
        else
            sum[i]=sum[i-1]+a[s[i]-'a'];
        pos[s[i]-'a'][cnt[s[i]-'a']]=i;
        cnt[s[i]-'a']++;
    }
    long long ans=0;
    for(i=0;i<26;i++)
    {
        memset(b,0,sizeof(b));
        for(j=0;j<cnt[i];j++)
        {
            b[j].v=sum[pos[i][j]];
            b[j].p=pos[i][j];
            if(pos[i][j]>0)
            {
                b[j+cnt[i]].v=sum[pos[i][j]-1];
                b[j+cnt[i]].p=pos[i][j]-1;
            }
            else
            {
                b[j+cnt[i]].v=1e15;
                b[j+cnt[i]].p=0;
            }
            b[j].t=2;
            b[j+cnt[i]].t=1;
        }
        sort(b,b+2*cnt[i],cmp);
        for(j=0;j<cnt[i]*2;j++)
            if(b[j].v==b[j+1].v && b[j].t!=b[j+1].t)
            {
               // printf("%d %d %d %d\n",b[j].t,b[j+1].t,b[j].p,b[j+1].p);
                if(b[j].t<b[j+1].t && b[j].p>=b[j+1].p)
                    ans++;
                if(b[j].t>b[j+1].t && b[j].p<=b[j+1].p)
                    ans++;
            }
    }
    printf("%I64d\n",ans);
    return 0;
}


#include <iostream>
#include <vector>
#include <map>
using namespace std;
string s;
int i,j,m,n,o,p,a,b,l[200],ok;
map <int,int> v[200];
int main()
{
    for(i=1;i<=1;i++)
    {
        cin>>l[i+96];
    }
    cin>>s;
    for(i=0;s[i];i++)
    {
        m=(int)s[i];

        a+=l[m];
        o=a-2*l[m];
        if(v[m][-o])
            ok+=v[m][-o];
        if(v[m][a-l[m]])
        v[m][-(a-l[m])]++;
        else
        v[m][-(a-l[m]) ]=1;

    }
    cout<<ok;
    return 0;
}


#include <iostream>
#include <vector>
#include <map>
using namespace std;
string s;
long long int i,j,m,n,o,p,a,b,l[200],ok;
map <long long int,long long int> v[200];
int main()
{
    for(i=1;i<=26;i++)
    {
        cin>>l[i+96];
    }
    cin>>s;
    for(i=0;i<s.size();i++)
    {
        m=(int)s[i];

        ok+=v[m][a];
        a+=l[m];
        v[m][a]++;

    }
    cout<<ok;
    return 0;
}


#include <iostream>
#include <vector>
#include <map>
using namespace std;
string s;
long long int i,j,m,n,o,p,a,b,l[200],ok;
map <int,long long int> v[200];
int main()
{
    for(i=1;i<=26;i++)
    {
        cin>>l[i+96];
    }
    cin>>s;
    for(i=0;s[i];i++)
    {
        m=(int)s[i];

        a+=l[m];
        ok+=v[m][a-l[m]];
        v[m][a]++;

    }
    cout<<ok;
    return 0;
}


#include <iostream>
#include <vector>
#include <map>
using namespace std;
string s;
long long int i,j,m,n,o,p,a,b,l[200],ok;
map <int,long long int> v[200];
int main()
{
    for(i=1;i<=26;i++)
    {
        cin>>l[i+96];
    }
    cin>>s;
    for(i=0;s[i];i++)
    {
        m=(int)s[i];

        a+=l[m];
        o=a-2*l[m];
        if(v[m][-o])
            ok+=v[m][-o];
        if(v[m][-(a-l[m])])
        v[m][-(a-l[m])]++;
        else
        v[m][-(a-l[m]) ]=1;

    }
    cout<<ok;
    return 0;
}


#include <iostream>
#include <vector>
#include <map>
using namespace std;
string s;
int i,j,m,n,o,p,a,b,l[200],ok;
map <int,int> v[200];
int main()
{
    for(i=1;i<=26;i++)
    {
        cin>>l[i+96];
    }
    cin>>s;
    for(i=0;s[i];i++)
    {
        m=(int)s[i];

        a+=l[m];
        o=a-2*l[m];
        if(v[m][-o])
            ok+=v[m][-o];
        if(v[m][a-l[m]])
        v[m][-(a-l[m])]++;
        else
        v[m][-(a-l[m]) ]=1;

    }
    cout<<ok;
    return 0;
}


#include <iostream>
#include <vector>
#include <map>
using namespace std;
string s;
long long int i,j,m,n,o,p,a,b,l[200],ok;
map <int,int> v[200];
int main()
{
    for(i=1;i<=26;i++)
    {
        cin>>l[i+96];
    }
    cin>>s;
    for(i=0;s[i];i++)
    {
        m=(int)s[i];

        a+=l[m];
        o=a-2*l[m];
        if(v[m][-o])
            ok+=v[m][-o];
        if(v[m][-(a-l[m])])
        v[m][-(a-l[m])]++;
        else
        v[m][-(a-l[m]) ]=1;

    }
    cout<<ok;
    return 0;
}


#include <iostream>
#include <vector>
#include <map>
using namespace std;
string s;
int i,j,m,n,o,p,a,b,l[200],ok;
vector <int> v[200];
int main()
{
    for(i=1;i<=26;i++)
    {
        cin>>l[i+96];
    }
    cin>>s;
    for(i=0;s[i];i++)
    {
        m=(int)s[i];
        v[m].push_back(a);
        a+=l[m];

        for(j=0;j<v[m].size()-1;j++)
        {
            o=a-v[m][j];
            o-=2*l[m];
            if(o==0)
                ok++;
        }

    }
    cout<<ok;
    return 0;
}


#include <iostream>
#include <vector>
#include <map>
using namespace std;
string s;
int i,j,m,n,o,p,a,b,l[200],ok;
map <int,int> v[200];
int main()
{
    for(i=1;i<=26;i++)
    {
        cin>>l[i+96];
    }
    cin>>s;
    for(i=0;s[i];i++)
    {
        m=(int)s[i];

        a+=l[m];
        o=-a+2*l[m];
        if(v[m][o])
            ok+=v[m][o];
        if(v[m][a-l[m]])
        v[m][(a-l[m])]++;
        else
        v[m][(a-l[m]) ]=1;

    }
    cout<<ok;
    return 0;
}


#include <iostream>
#include <vector>
#include <map>
using namespace std;
string s;
int i,j,m,n,o,p,a,b,l[200],ok;
map <int,int> v[200];
int main()
{
    for(i=1;i<=26;i++)
    {
        cin>>l[i+96];
    }
    cin>>s;
    for(i=0;s[i];i++)
    {
        m=(int)s[i];

        a+=l[m];
        o=a-2*l[m];
        if(v[m][-o])
            ok+=v[m][-o];
        if(v[m][-(a-l[m])])
        v[m][-(a-l[m])]++;
        else
        v[m][-(a-l[m]) ]=1;

    }
    cout<<ok;
    return 0;
}


#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<vector>

using namespace std;

string s;
int a[26],n,i,RS,sum,k,j;
vector<int> st[26];

int main()
{
    for (i=0;i<26;i++)
        cin>>a[i];

    cin>>s;

    for  (i=0;i<s.size();i++)
    {
        k=s[i]-'a';
        sum += a[k];
        st[k].push_back(sum);
    }

   /* for (i=0;i<26;i++)
    {
        cout<<char(i+'a')<<": ";
        for (j=0;j<st[i].size();j++)
            cout<<st[i][j]<<' ';
        cout<<'\n';
    }*/

    for (i=0;i<26;i++){
        sort(st[i].begin(),st[i].end());

        for (j=0;j<st[i].size();j++)
        {
            int val=st[i][j]+a[i];
            int l=0, r=st[i].size()-1;
            int pmin=-1,pmax;
            while (l<=r)
            {
                int mij=(l+r)/2;
                if (st[i][mij]>val)
                    r=mij-1;
                else if (st[i][mij]<val)
                    l=mij+1;
                else pmin=mij, r=mij-1;
            }
            l=0; r=st[i].size()-1;
            while (l<=r)
            {
                int mij=(l+r)/2;
                if (st[i][mij]>val)
                    r=mij-1;
                else if (st[i][mij]<val)
                    l=mij+1;
                else pmax=mij, l=mij+1;
            }
            if (pmin!=-1) RS+=pmax-pmin+1;
        }
    }
    cout << RS;
    return 0;
}


#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<vector>

using namespace std;
#define mod 103123

#define ll long long

string s;
int a[26],n,i,k;
ll sum,RS;
vector<pair<ll,ll> > h[26][mod];

ll cauta(vector<pair<ll,ll> >H[],ll val)
{
    int nod=val%mod;
    for (int i=0;i<H[nod].size();i++)
        if (H[nod][i].first==val)
        return H[nod][i].second;
    return 0;
}

void insereaza(vector<pair<ll,ll> >H[], ll val)
{
    int nod=val%mod;
    for (int i=0;i<H[nod].size();i++)
        if (H[nod][i].first==val)
        {
           ++H[nod][i].second;
           return;
        }
    H[nod].push_back(make_pair(val,1));
}

int main()
{
    for (i=0;i<26;i++)
        cin>>a[i];

    cin>>s;

    for  (i=0;i<s.size();i++)
    {
        k=s[i]-'a';
        sum += a[k];
        RS += cauta(h[k],sum-a[k]);
        insereaza(h[k],sum);
    }

    cout << RS;
    return 0;
}


#include<iostream>
#include<string>
#include<vector>
#include<algorithm>

using namespace std;

string s;
int a[26];

#define pb push_back
#define mp make_pair
#define mod 1234
#define ll long long

int i;
ll sum,RS;
vector< pair<ll,ll> > h[26][mod];

ll cauta(int k, ll val)
{
    int nod=val%mod;
    for (int i=0;i<h[k][nod].size();i++)
    if (h[k][nod][i].first==val){
        return h[k][nod][i].second;
    }
    return 0;
}

void insereaza(int k, ll val)
{
    int nod=val%mod;
    for (int i=0;i<h[k][nod].size();i++)
    if (h[k][nod][i].first==val){
         h[k][nod][i].second++;
         return;
    }
    h[k][nod].pb(mp(val,1));
}

int main()
{
    for (i=0;i<26;i++) cin>>a[i];
    cin>>s;
    for (i=0;i<s.size();i++)
    {
        int k=s[i]-'a';
        sum+=a[k];
        //cout<<sum<<'\n';
        RS += cauta(k,sum-a[k]);
        insereaza(k,sum);
    }
    cout<<RS;
    return 0;
}


#include<iostream>
#include<string>
#include<vector>
#include<algorithm>

using namespace std;

string s;
int a[26];

#define pb push_back
#define mp make_pair
#define mod 1234
#define ll long long

int i;
ll sum,RS;
vector< pair<ll,int> > h[26][mod];

int cauta(int k, ll val)
{
    int nod=val%mod;
    for (int i=0;i<h[k][nod].size();i++)
    if (h[k][nod][i].first==val){
        return h[k][nod][i].second;
    }
    return 0;
}

void insereaza(int k, ll val)
{
    int nod=val%mod;
    for (int i=0;i<h[k][nod].size();i++)
    if (h[k][nod][i].first==val){
         h[k][nod][i].second++;
         return;
    }
    h[k][nod].pb(mp(val,1));
}

int main()
{
    for (i=0;i<26;i++) cin>>a[i];
    cin>>s;
    for (i=0;i<s.size();i++)
    {
        int k=s[i]-'a';
        sum+=a[k];
        //cout<<sum<<'\n';
        RS += cauta(k,sum-a[k]);
        insereaza(k,sum);
    }
    cout<<RS;
    return 0;
}


#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<vector>

using namespace std;
#define mod 103123

string s;
int a[26],n,i,RS,sum,k;
vector<pair<int,int> > h[26][mod];

int cauta(vector<pair<int,int> >H[],int val)
{
    int nod=val%mod;
    for (int i=0;i<H[nod].size();i++)
        if (H[nod][i].first==val)
        return H[nod][i].second;
    return 0;
}

void insereaza(vector<pair<int,int> >H[], int val)
{
    int nod=val%mod;
    for (int i=0;i<H[nod].size();i++)
        if (H[nod][i].first==val)
        {
           ++H[nod][i].second;
           return;
        }
    H[nod].push_back(make_pair(val,1));
}

int main()
{
    for (i=0;i<26;i++)
        cin>>a[i];

    cin>>s;

    for  (i=0;i<s.size();i++)
    {
        k=s[i]-'a';
        sum += a[k];
        RS += cauta(h[k],sum-a[k]);
        insereaza(h[k],sum);
    }

    cout << RS;
    return 0;
}


#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<vector>

using namespace std;

string s;
int a[26],n,i,RS,sum,k,j;
vector<int> st[26];

int main()
{
    for (i=0;i<26;i++)
        cin>>a[i];

    cin>>s;

    for  (i=0;i<s.size();i++)
    {
        k=s[i]-'a';
        sum += a[k];
        st[k].push_back(sum);
    }
    for (i=0;i<26;i++){
        sort(st[i].begin(),st[i].end());

        for (j=0;j+1<st[i].size();j++)
        {
            int val=st[i][j]+a[i];
            int l=j+1, r=st[i].size()-1;
            int pmin=-1,pmax;
            while (l<=r)
            {
                int mij=(l+r)/2;
                if (st[i][mij]>val)
                    r=mij-1;
                else if (st[i][mij]<val)
                    l=mij+1;
                else pmin=mij, r=mij-1;
            }
            l=j+1; r=st[i].size()-1;
            while (l<=r)
            {
                int mij=(l+r)/2;
                if (st[i][mij]>val)
                    r=mij-1;
                else if (st[i][mij]<val)
                    l=mij+1;
                else pmax=mij, l=mij+1;
            }
            if (pmin!=-1) RS+=pmax-pmin+1;
        }
    }
    cout << RS;
    return 0;
}


#include<iostream>
#include<string>
#include<algorithm>
#include<set>

using namespace std;

string s;
int a[26],n,i,RS,sum,k;
multiset<int> st[26];

int main()
{
    for (i=0;i<26;i++)
        cin>>a[i];

    cin>>s;

    for  (i=0;i<s.size();i++)
    {
        k=s[i]-'a';
        sum += a[k];
        RS += st[k].count(sum-a[k]);
        st[k].insert(sum);
    }

    cout << RS;
    return 0;
}


#include<iostream>
#include<string>
#include<vector>
#include<algorithm>

using namespace std;

string s;
int a[26];

#define pb push_back
#define mp make_pair
#define mod 1234
#define ll long long

int i;
ll sum,RS;
vector< pair<ll,ll> > h[26][mod];

ll cauta(int k, ll val)
{
    int nod= abs(val%mod);
    for (int i=0;i<h[k][nod].size();i++)
    if (h[k][nod][i].first==val){
        return h[k][nod][i].second;
    }
    return 0;
}

void insereaza(int k, ll val)
{
    int nod= abs(val%mod);
    for (int i=0;i<h[k][nod].size();i++)
    if (h[k][nod][i].first==val){
         h[k][nod][i].second++;
         return;
    }
    h[k][nod].pb(mp(val,1));
}

int main()
{
    for (i=0;i<26;i++) cin>>a[i];
    cin>>s;
    for (i=0;i<s.size();i++)
    {
        int k=s[i]-'a';
        sum+=a[k];
        //cout<<sum<<'\n';
        RS += cauta(k,sum-a[k]);
        insereaza(k,sum);
    }
    cout<<RS;
    return 0;
}


#include<fstream>
#include<string>
#include<algorithm>
#include<set>
#include<vector>

using namespace std;
#define mod 103123

ifstream cin("pd.in");
ofstream cout("pd.out");

string s;
int a[26],n,i,RS,sum,k;
vector<pair<int,int> > h[26][mod];

int cauta(vector<pair<int,int> >H[],int val)
{
    int nod=val%mod;
    for (int i=0;i<H[nod].size();i++)
        if (H[nod][i].first==val)
        return H[nod][i].second;
    return 0;
}

void insereaza(vector<pair<int,int> >H[], int val)
{
    int nod=val%mod;
    for (int i=0;i<H[nod].size();i++)
        if (H[nod][i].first==val)
        {
           ++H[nod][i].second;
           return;
        }
    H[nod].push_back(make_pair(val,1));
}

int main()
{
    for (i=0;i<26;i++)
        cin>>a[i];

    cin>>s;

    for  (i=0;i<s.size();i++)
    {
        k=s[i]-'a';
        sum += a[k];
        RS += cauta(h[k],sum-a[k]);
        insereaza(h[k],sum);
    }

    cout << RS;
    return 0;
}


#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<vector>

using namespace std;

string s;
int a[26],n,i,RS,sum,k,j;
vector<int> st[26];

int main()
{
    for (i=0;i<26;i++)
        cin>>a[i];

    cin>>s;

    for  (i=0;i<s.size();i++)
    {
        k=s[i]-'a';
        sum += a[k];
        st[k].push_back(sum);
    }

   /* for (i=0;i<26;i++)
    {
        cout<<char(i+'a')<<": ";
        for (j=0;j<st[i].size();j++)
            cout<<st[i][j]<<' ';
        cout<<'\n';
    }*/
    for (i=0;i<26;i++){
        sort(st[i].begin(),st[i].end());

        for (j=0;j<st[i].size();j++)
        {
            int val=st[i][j]+a[i];
            int l=0, r=st[i].size()-1;
            int pmin=-1,pmax;
            while (l<=r)
            {
                int mij=(l+r)/2;
                if (st[i][mij]>val)
                    r=mij-1;
                else if (st[i][mij]<val)
                    l=mij+1;
                else pmin=mij, r=mij-1;
            }
            l=0; r=st[i].size()-1;
            while (l<=r)
            {
                int mij=(l+r)/2;
                if (st[i][mij]>val)
                    r=mij-1;
                else if (st[i][mij]<val)
                    l=mij+1;
                else pmax=mij, l=mij+1;
            }
            if (pmin!=-1) {RS+=pmax-pmin+1;
                           if (pmin<=j && j<=pmax) RS--;
            }
        }
    }
    cout << RS;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define pb push_back
#define mp make_pair
#define ff first
#define ss second

typedef long long int ll;
typedef vector< pair<ll, ll> > vii;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> pii;

const ll INF = 1e18;
const ll inf = 1e9;
const ll MOD = 1e9 + 7;
const ll nax = 1000000 + 10;

vector< map<int, ll> > map1(27);

ll arr[26];

int main()
{
    ios::sync_with_stdio(0);
    for(ll i = 0; i < 26; i++) cin >> arr[i];
    string s;
    cin >> s;
    ll n = s.length();
    ll cnt = 0;
    ll sum = 0;
    for(ll i = 0; i < n; i++)
    {
        cnt += map1[s[i] - 'a'][sum];
        sum += arr[s[i] - 'a'];
        map1[s[i] - 'a'][sum]++;
    }
    cout << cnt << endl;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define pb push_back
#define mp make_pair
#define ff first
#define ss second

typedef long long int ll;
typedef vector< pair<ll, ll> > vii;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> pii;

const ll INF = 1e18;
const ll inf = 1e9;
const ll MOD = 1e9 + 7;
const ll nax = 1000000 + 10;

vector< map<ll , ll> > map1(27);

ll arr[26];

int main()
{
    ios::sync_with_stdio(0);
    for(ll i = 0; i < 26; i++) cin >> arr[i];
    string s;
    cin >> s;
    ll n = s.length();
    ll cnt = 0;
    ll sum = 0;
    for(ll i = 0; i < n; i++)
    {
        ll clone = s[i] - 'a';
        cnt += map1[clone][sum];
        sum += arr[clone];
        map1[clone][sum]++;
    }
    cout << cnt << endl;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define pb push_back
#define mp make_pair
#define ff first
#define ss second

typedef long long int ll;
typedef vector< pair<ll, ll> > vii;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> pii;

const ll INF = 1e18;
const ll inf = 1e9;
const ll MOD = 1e9 + 7;
const ll nax = 1000000 + 10;

vector< map<int, ll> > map1(27);

ll arr[26];

int main()
{
    ios::sync_with_stdio(0);
    for(ll i = 0; i < 26; i++) cin >> arr[i];
    string s;
    cin >> s;
    ll n = s.length();
    ll cnt = 0;
    ll sum = 0;
    for(ll i = 0; i < n; i++)
    {
        int clone = s[i] - 'a';
        cnt += map1[clone][sum];
        sum += arr[clone];
        map1[clone][sum]++;
    }
    cout << cnt << endl;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define pb push_back
#define mp make_pair
#define ff first
#define ss second

typedef long long int ll;
typedef vector< pair<ll, ll> > vii;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> pii;

const ll INF = 1e18;
const ll inf = 1e9;
const ll MOD = 1e9 + 7;
const ll nax = 1000000 + 10;

vector< map<int, ll> > map1(27);

int arr[26];

int main()
{
    ios::sync_with_stdio(0);
    for(int i = 0; i < 26; i++) cin >> arr[i];
    string s;
    cin >> s;
    int n = s.length();
    ll cnt = 0;
    ll sum = 0;
    for(int i = 0; i < n; i++)
    {
        cnt += map1[s[i] - 'a'][sum];
        sum += arr[s[i] - 'a'];
        map1[s[i] - 'a'][sum]++;
    }
    cout << cnt << endl;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define pb push_back
#define mp make_pair
#define ff first
#define ss second

typedef long long int ll;
typedef vector< pair<ll, ll> > vii;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> pii;

const ll INF = 1e18;
const ll inf = 1e9;
const ll MOD = 1e9 + 7;
const ll nax = 1000000 + 10;

vector< map<int, int> > map1(27);

int arr[26];

int main()
{
    ios::sync_with_stdio(0);
    for(int i = 0; i < 26; i++) cin >> arr[i];
    string s;
    cin >> s;
    int n = s.length();
    int cnt = 0;
    int sum = 0;
    for(int i = 0; i < n; i++)
    {
        cnt += map1[s[i] - 'a'][sum];
        sum += arr[s[i] - 'a'];
        map1[s[i] - 'a'][sum]++;
    }
    cout << cnt << endl;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define pb push_back
#define mp make_pair
#define ff first
#define ss second

typedef long long int ll;
typedef vector< pair<ll, ll> > vii;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> pii;

const ll INF = 1e18;
const ll inf = 1e9;
const ll MOD = 1e9 + 7;
const ll nax = 1000000 + 10;

vector< map<int, ll> > map1(27);

int arr[26];

int main()
{
    ios::sync_with_stdio(0);
    for(int i = 0; i < 26; i++) cin >> arr[i];
    string s;
    cin >> s;
    int n = s.length();
    ll cnt = 0;
    ll sum = 0;
    for(int i = 0; i < n; i++)
    {
        cnt += (ll)map1[(int)(s[i] - 'a')][sum];
        sum += arr[(int)(s[i] - 'a')];
        map1[int(s[i] - 'a')][sum]++;
    }
    cout << cnt << endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5 ;
const double eps = 1e-9 ;
const int MAX_N = 5e6 + 5 ;
const long long M = (long long)1e9+7 ;
#define     ll      long long
#define     ull     unsigned long long
int Int() {
    int x;
    scanf("%d",&x);
    return x;
}
ll Long() {
    ll x;
    scanf("%lld",&x);
    return x;
}
void Char(char* ch) {
    scanf("%s",ch);
}
template<typename t>inline t abs(t a) { if(a>=0) return a; return -a;}
template<typename t>inline t gcd(t a , t b) {return !b ? a : gcd(b , a % b);}
template<typename t>inline t lcm(t a , t b) {return a * ( b /gcd(a , b));}
template<typename T>inline T modpow(T b, T p, T Mod) {
    T res  = 1;
    while(p) {
        if(p&1) {
            res *= b ;
            res %= Mod ;
        }
        b *= b;
        b %= Mod;
        p >>= 1;
    }
    return res ;
}

template<typename T> inline T ModInv(T b, T Mod) {return modpow(b, Mod - 2, Mod );}

template<typename T> inline T pwr(T b, T p) {
    T res  = 1;
    while(p) {
        if(p&1) {
            res *= b ;
        }
        b *= b;
        p >>= 1;
    }
    return res ;
}
int e1 , e2 , d1 ;
template < typename T >inline void extgcd(T a , T b){
    if(!b) {e1 = 1 , e2 = 0 , d1 = a ; return ;}
    extgcd(b , a % b) ;
    T x1 = e2 ;
    T y1 = e1 - (a / b) * e2 ;
    e1 = x1 ;
    e2 = y1 ;
}

/*primes in range 1 - n
1 - 100(1e2) -> 25 pimes
1 - 1000(1e3) -> 168 primes
1 - 10000(1e4) -> 1229 primes
1 - 100000(1e5) -> 9592 primes
1 - 1000000(1e6) -> 78498 primes
1 - 10000000(1e7) -> 664579 primes
large primes ->
104729 1299709 15485863 179424673 2147483647 32416190071 112272535095293 48112959837082048697

std::vector<int> primes;
bitset < MAX_N > bs;
ll sieve_size = MAX_N ;

void sieve(ll n){
    bs.set() ;
    primes.push_back(1);
    bs[0] = bs[1] = 1 ;
    for(ll i = 2 ; i <= n ; i++)if(bs[i]){
        for(ll j = i * i ; j <= n ; j += i) bs[j] = 0 ;
            primes.push_back((int)i);
    }
}
bool isprime(ll n){
    if(n <= sieve_size)return bs[n] ;
    for(int i = 0 ; i <= (int)primes.size() ; i++){
        if(n % primes[i] == 0)return false ;
    }
    return true ;
}

int numDiffPf[MAX_N] ;

void DiffPF(){
    for(int i = 2 ; i < MAX_N ; i++){
        if(numDiffPf[i] == 0){
            for(int j = i ; j < MAX_N ; j += i)numDiffPf[j]++;
        }
    }
}

int Phi[MAX_N] ;

void EulerPHI(){
    for(int i = 1 ; i < MAX_N ; i++)Phi[i] = i ;
        for(int i = 2 ; i < MAX_N ; i++)
            if(Phi[i] == i)
                for(int j = i ; j < MAX_N ; j += i)
                    Phi[j] = (Phi[j]/i) * (i - 1) ;
}

int F(int x){
    return 0 ;
}
pair < int , int > floydCycle(int x0){
    int tor = F(x0) , hare = F(F(x0)) ;
    while(tor != hare){tor = F(tor) , hare = F(F(hare));}
    int mu = 0 ; hare = x0 ;
    while(tor != hare){tor = F(tor) , hare = F(hare); mu++ ;}
    int lambda = 1 ; hare = F(tor) ;
    while(tor != hare){hare = F(hare) ; lambda++;}
    return {mu , lambda} ;
}
*/
template <typename T>inline vector< T > Unique(vector< T > v) {
    sort(v.begin(), v.end());
    v.erase(unique(v.begin(), v.end()),v.end());
    return v;
}
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
///error///
#define error(args...) {vector<string>_v=split(#args,',');err(_v.begin(),args);cout<<endl;}
vector<string> split(const string &s,char c) {
    vector<string>v;
    stringstream ss(s);
    string x;
    while(getline(ss,x,c))
        v.emplace_back(x);
    return move(v);
}

void err(vector<string>::iterator it) {}
template<typename T,typename... Args>
void err(vector<string>::iterator it,T a,Args...args) {
    cout<<it->substr((*it)[0]==' ',it->length())<< " = " << a << " ";
    err(++it,args...);
}
///This DEBUGGER-tool need c++11///
#define     Int         Int()
#define     Long        Long()
#define     pii         pair<int,int>
#define     ff          first
#define     ss          second
#define     pb            push_back
#define     eb            emplace_back
#define     all(x)      x.begin(),x.end()
#define     mem(a)      memset(a,0,sizeof a)
#define     memn(a)     memset(a,-1,sizeof a)

int main() {
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    int t = 1 , tc = 0 ;
    while(t--) {
        std::vector< int > v(26);
        for(int i = 0 ; i < 26 ; i++){
            v[i] = Int ;
        }
        string s ; cin >> s ;
        map< int , ll > cnt[27] ;
        ll tot = 0 , res = 0 ;
        for(int i = 0 ; s[i] ; i++){
            if(cnt[s[i] - 'a'].find(tot) != cnt[s[i] - 'a'].end())
                res += cnt[s[i] - 'a'][tot] ;
            tot += 1LL * v[s[i] - 'a'] ;
            cnt[s[i] - 'a'][tot] += 1LL;
        }
        cout << res << '\n' ;
    }
    return 0;
}