#include <bits/stdc++.h>
using namespace std;
const long long nax = 3e5 + 1;
vector<long long> g[nax];
signed main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  ;
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    long long tot_sum = 0;
    long long a[n + 1];
    for (long long i = 1; i <= n; i++) cin >> a[i], tot_sum += a[i];
    if (tot_sum % n != 0)
      cout << "-1\n";
    else {
      cout << 3 * n - 3 << "\n";
      for (long long i = 2; i <= n; i++) {
        long long req = a[i] % i;
        if (req) req = i - req;
        cout << "1 " << i << " " << req << "\n";
        a[1] -= req;
        a[i] += req;
        cout << i << " "
             << "1 " << a[i] / i << "\n";
      }
      for (long long i = 2; i <= n; i++)
        cout << "1 " << i << " " << tot_sum / n << "\n";
    }
  }
}
