#include <bits/stdc++.h>
using namespace std;
const int inf = int(1e9) + 10000;
void solve() {
  long long int n, sum = 0;
  cin >> n;
  vector<long long int> v(n);
  for (long long int i = 0; i < n; i++) {
    cin >> v[i];
    sum += v[i];
  }
  if (sum % n != 0) {
    cout << -1 << '\n';
    return;
  }
  vector<pair<pair<long long int, long long int>, long long int> > ans;
  for (long long int i = 1; i < n; i++) {
    if (v[i] % (i + 1) == 0) {
      ans.push_back({{i + 1, 1}, (v[i] / (i + 1))});
    } else {
      long long int x = i + 1 - (v[i] % (i + 1));
      ans.push_back({{1, i + 1}, x});
      long long int y = (v[i] + i) / (i + 1);
      ans.push_back({{i + 1, 1}, y});
    }
  }
  long long int req = sum / n;
  for (long long int i = 1; i < n; i++) {
    ans.push_back({{1, (i + 1)}, req});
  }
  cout << ans.size() << '\n';
  for (auto p : ans) {
    cout << p.first.first << " " << p.first.second << " " << p.second << '\n';
  }
  return;
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  long long int t = 1;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
