#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> x(n);
  for (int i = 0; i < n; ++i) {
    cin >> x[i];
  }
  double maxV = 0.0;
  for (int i = 0; i < m; ++i) {
    int a, b, c;
    cin >> a >> b >> c;
    if (c != 0) {
      maxV = max(maxV, (x[a - 1] + x[b - 1]) / (double)c);
    }
  }
  cout << setprecision(15) << fixed << maxV << endl;
  return 0;
}
