#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n, m, i;
  cin >> n >> m;
  long long a[n + 5];
  double ans = 0;
  for (i = 1; i <= n; i++) {
    cin >> a[i];
  }
  long long u, v, c;
  double local = 0;
  for (i = 0; i < m; i++) {
    cin >> u >> v >> c;
    local = 1.0 * (a[u] + a[v]) / c;
    ans = max(ans, local);
  }
  cout << fixed << setprecision(15) << ans << endl;
}
int32_t main() {
  long long t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
