#include <bits/stdc++.h>
using namespace std;
int n, m;
int val[510];
int main() {
  while (~scanf("%d%d", &n, &m)) {
    for (int i = 1; i <= n; i++) scanf("%d", val + i);
    double ans = 0;
    while (m--) {
      int u, v, w;
      scanf("%d%d%d", &u, &v, &w);
      ans = max(ans, (val[u] + val[v] + 0.0) / w);
    }
    printf("%.10lf\n", ans);
  }
  return 0;
}
