#include <bits/stdc++.h>
int a[501];
int main() {
  int n, m, i, u, v;
  scanf("%d%d", &n, &m);
  for (i = 1; i <= n; ++i) scanf("%d", a + i);
  double ans = 0, c;
  for (i = 0; i < m; ++i) {
    scanf("%d%d%lf", &u, &v, &c);
    if ((a[u] + a[v]) / c > ans) ans = (a[u] + a[v]) / c;
  }
  printf("%.11lf\n", ans);
  return 0;
}
