#include <bits/stdc++.h>
using namespace std;
const int MAXN = 500 + 19;
int n, m, a[MAXN];
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> a[i];
  double ans = 0;
  while (m--) {
    int v, u, w;
    cin >> v >> u >> w;
    ans = max(ans, 1.0 * (a[v] + a[u]) / w);
  }
  cout << fixed << setprecision(10) << ans << endl;
  return 0;
}
