#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  long long n, m;
  cin >> n >> m;
  double x[n];
  for (auto &i : x) cin >> i;
  double ans = 0;
  while (m--) {
    long long u, v, c;
    cin >> u >> v >> c;
    u--;
    v--;
    ans = max(ans, (x[u] + x[v]) / c);
  }
  cout << fixed << setprecision(9) << ans << endl;
  return 0;
}
