#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n, s = 0;
    cin >> n;
    int a[n];
    for (int i = 0; i < n; i++) {
      cin >> a[i];
      s += a[i];
    }
    if (s % n != 0)
      cout << "-1\n";
    else {
      int ans = n - 1;
      for (int i = 1; i < n; i++) {
        if (a[i] % (i + 1) == 0)
          ans++;
        else
          ans += 2;
      }
      cout << ans << "\n";
      for (int i = 1; i < n; i++) {
        if (a[i] % (i + 1) == 0) {
          cout << i + 1 << " 1 " << a[i] / (i + 1) << "\n";
        } else {
          cout << "1 " << i + 1 << " " << i + 1 - (a[i] % (i + 1)) << "\n";
          a[i] += i + 1 - (a[i] % (i + 1));
          cout << i + 1 << " 1 " << a[i] / (i + 1) << "\n";
        }
      }
      for (int i = 1; i < n; i++) {
        cout << "1 " << i + 1 << " " << s / n << "\n";
      }
    }
  }
}
