#include <bits/stdc++.h>
using namespace std;
int main() {
  cout << setprecision(20);
  int n, m;
  cin >> n >> m;
  vector<int> vs(n);
  for (int i = 0; i < n; ++i) {
    cin >> vs[i];
  }
  double best = 0;
  for (int i = 0; i < m; ++i) {
    int from, to, e;
    cin >> from >> to >> e;
    double value =
        static_cast<double>(vs[from - 1] + vs[to - 1]) / static_cast<double>(e);
    best = max(best, value);
  }
  cout << best;
  return 0;
}
