#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, a, b, c;
  while (cin >> n >> m) {
    vector<double> nodes;
    double node, avr, old_avr = 0;
    for (int i = 0; i < n; i++) {
      cin >> node;
      nodes.push_back(node);
    }
    for (int i = 0; i < m; i++) {
      cin >> a >> b >> c;
      avr = static_cast<double>(nodes[a - 1] + nodes[b - 1]) / c;
      if (avr > old_avr) old_avr = avr;
    }
    cout << fixed << setprecision(20) << old_avr << endl;
  }
  return 0;
}
