#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n;
  cin >> n;
  long long arr[n + 1];
  long long sum = 0;
  for (long long i = 1; i <= n; i++) {
    cin >> arr[i];
    sum += arr[i];
  }
  if (sum % n != 0) {
    cout << -1 << "\n";
    return;
  }
  vector<pair<long long, pair<long long, long long>>> ans;
  for (long long i = 2; i <= n; i++) {
    long long brak = (i - arr[i] % i) % i;
    ans.push_back(make_pair(1, make_pair(i, brak)));
    arr[1] -= brak;
    arr[i] += brak;
    ans.push_back(make_pair(i, make_pair(1, arr[i] / i)));
    arr[1] += arr[i];
    arr[i] = 0;
  }
  for (long long i = 2; i <= n; i++) {
    ans.push_back(make_pair(1, make_pair(i, sum / n)));
  }
  cout << ans.size() << "\n";
  for (auto x : ans) {
    cout << x.first << " " << x.second.first << " " << x.second.second << "\n";
  }
}
int32_t main() {
  {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
  }
  long long t = 1;
  cin >> t;
  while (t--) solve();
  return 0;
}
