#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline void upd_max(T& a, const T& b) {
  if (a < b) a = b;
}
const int MAXV = 511;
int V, E;
int r[MAXV][MAXV], v[MAXV];
int main() {
  while (scanf("%d%d", &V, &E) > 0) {
    for (int i = 1; i <= V; i++) scanf("%d", v + i);
    memset(r, 0, sizeof(r));
    for (int i = 1; i <= E; i++) {
      int v1, v2, weight;
      scanf("%d%d%d", &v1, &v2, &weight);
      r[v1][v2] = r[v2][v1] = weight;
    }
    double ans = .0;
    for (int i = 1; i <= V; i++)
      for (int j = 1; j <= V; j++)
        if (i != j && r[i][j] > 0)
          upd_max(ans, (((double)v[i]) + v[j]) / r[i][j]);
    printf("%.10lf\n", ans);
  }
  return 0;
}
