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