#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  int t;
  cin >> t;
  while (t--) {
    int n, s = 0;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; ++i) {
      cin >> a[i];
      s += a[i];
    }
    if (s % n) {
      cout << -1 << endl;
      continue;
    }
    s /= n;
    cout << (3 * n - 3) << endl;
    for (int i = 1; i < n; ++i) {
      int x = (a[i] + i) / (i + 1) * (i + 1);
      cout << "1 " << (i + 1) << " " << (x - a[i]) << endl;
      cout << (i + 1) << " 1 " << x / (i + 1) << endl;
    }
    for (int i = 1; i < n; ++i) {
      cout << "1 " << (i + 1) << " " << s << endl;
    }
  }
}
