#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 90;
const int inf = 1e9 + 90;
string s[4];
long long a[N];
int n, T;
vector<int> f[N];
int main() {
  ios::sync_with_stdio(0);
  cin >> T;
  while (T--) {
    cin >> n;
    long long sum = 0;
    for (int i = 1; i <= n; i++) cin >> a[i], sum += a[i];
    int mid = sum / n;
    if (sum % n) {
      cout << -1 << "\n";
    } else {
      cout << 3 * n - 3 << endl;
      for (int i = 2; i <= n; i++) {
        int tmp = (i - a[i] % i) % i;
        cout << 1 << ' ' << i << ' ' << tmp << "\n";
        cout << i << ' ' << 1 << ' ' << (a[i] + tmp) / i << "\n";
      }
      for (int i = 2; i <= n; i++)
        cout << 1 << ' ' << i << ' ' << sum / n << "\n";
    }
  }
}
