#include <iostream>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n, i, j, pom;
    long long suma = 0;
    int IN [300];
    int OUT [300];
    bool mozliwe = true;

    cin >> n;
    for (i = 0; i < n; i++)
        cin >> IN [i];

    // teraz sprawdze, czy ciąg istnieje.

    for (i = 1; i < n; i++)
    {
        pom = i/2;
        for (j = 0; j < pom; j++)
        {
            if (IN[i]>(IN[j] + IN[i-j-1]))
                mozliwe = false;
        }
    }
    if (mozliwe)
    {
        cout << "TAK\n" << (((n+3) * n)/2) << "\n";

        //teraz czas na wygenerowanie ciagu

        for (i = 0; i < n; i++)
        {
            OUT[i]=IN[i]-suma;
            suma += OUT[i];

            for (j = 0; j <=i; j++)
            {
                cout << OUT[j] << " ";
            }

            cout << -10000000000000 << " ";
        }
    }
    else
        cout << "NIE";
    return 0;
}
