#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 10, inf = 1e9 + 10;
int a[N];
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    int sum = 0;
    for (int i = 1; i <= n; ++i) cin >> a[i], sum += a[i];
    if (sum % n) {
      cout << -1 << "\n";
      continue;
    }
    vector<pair<int, pair<int, int>>> ans;
    for (int i = 2; i <= n; ++i) {
      ans.push_back({1, {i, (i - a[i] % i) % i}});
      ans.push_back({i, {1, (a[i] + i - 1) / i}});
      a[i] = 0;
    }
    for (int i = 2; i <= n; ++i) {
      ans.push_back({1, {i, sum / n - a[i]}});
    }
    cout << ans.size() << "\n";
    for (auto v : ans)
      cout << v.first << " " << v.second.first << " " << v.second.second
           << "\n";
  }
}
