#include <bits/stdc++.h>
using namespace std;
int a[1001];
int n, m;
int o, p, q;
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; ++i) cin >> a[i];
  double ans = 0;
  for (int i = 0; i < m; ++i) {
    cin >> p >> q >> o;
    if ((a[p] + a[q]) * 1.0 / o > ans) ans = ((a[p] + a[q]) * 1.0 / o);
  }
  printf("%.9lf", ans);
  return 0;
}
