#include <bits/stdc++.h>
using namespace std;
typedef struct {
  int s, t, cost;
} Edge;
int main(int argc, const char* argv[]) {
  int n, m;
  cin >> n >> m;
  vector<int> vs(n);
  vector<Edge> edges(m);
  double res = 0;
  for (int i = 0; i < n; i++) cin >> vs[i];
  for (int i = 0; i < m; i++) {
    int s, t, c;
    cin >> s >> t >> c;
    int v = vs[s - 1] + vs[t - 1];
    res = max(res, double(v) / c);
  }
  printf("%.9f\n", res);
  return 0;
}
