#include <bits/stdc++.h>
using namespace std;
void IO() {
  mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
int main() {
  IO();
  int t;
  cin >> t;
  while (t--) {
    long long int n;
    cin >> n;
    long long int sum = 0;
    vector<long long int> arr(n + 1);
    for (__typeof(n + 1) i = (1) - ((1) > (n + 1));
         i != (n + 1) - ((1) > (n + 1)); i += 1 - 2 * ((1) > (n + 1))) {
      cin >> arr[i];
      sum += arr[i];
    }
    long long int rem = sum % n;
    if (rem)
      cout << -1 << "\n";
    else {
      long long int want = sum / n;
      vector<pair<pair<long long int, long long int>, long long int> > ans;
      for (__typeof(n + 1) i = (2) - ((2) > (n + 1));
           i != (n + 1) - ((2) > (n + 1)); i += 1 - 2 * ((2) > (n + 1))) {
        long long int rem = arr[i] % i;
        arr[1] += arr[i];
        if (rem) {
          long long int more = i - rem;
          ans.push_back(make_pair(make_pair(1, i), more));
        }
        ans.push_back(make_pair(make_pair(i, 1), (arr[i] + i - 1) / i));
      }
      for (__typeof(n + 1) i = (2) - ((2) > (n + 1));
           i != (n + 1) - ((2) > (n + 1)); i += 1 - 2 * ((2) > (n + 1))) {
        ans.push_back(make_pair(make_pair(1, i), want));
      }
      long long int a = (int)(ans.size());
      cout << a << "\n";
      for (__typeof(a) i = (0) - ((0) > (a)); i != (a) - ((0) > (a));
           i += 1 - 2 * ((0) > (a))) {
        cout << ans[i].first.first << " " << ans[i].first.second << " "
             << ans[i].second << "\n";
      }
    }
  }
  return 0;
}
