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