#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int tt;
  cin >> tt;
  while (tt--) {
    int n;
    cin >> n;
    vector<long long> a(n + 1);
    long long sum = 0;
    for (int i = 1; i <= n; i++) {
      cin >> a[i];
      sum += a[i];
    }
    if (sum % n) {
      cout << -1 << '\n';
      continue;
    }
    long long m = sum / n;
    cout << 3 * (n - 1) << '\n';
    for (int i = 2; i <= n; i++) {
      long long mod = a[i] % i;
      mod = (i - mod) % i;
      cout << 1 << ' ' << i << ' ' << mod << '\n';
      long long mul = (a[i] + mod) / i;
      cout << i << ' ' << 1 << ' ' << mul << '\n';
    }
    for (int i = 2; i <= n; i++) {
      cout << 1 << ' ' << i << ' ' << m << '\n';
    }
  }
}
