#include <bits/stdc++.h>
using namespace std;
const int N = 505;
int x[N];
int n, m;
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> x[i];
  double ret = 0;
  while (m--) {
    int u, v, c;
    cin >> u >> v >> c;
    u--, v--;
    ret = max(1.0 * (x[u] + x[v]) / c, ret);
  }
  cout << fixed << setprecision(12) << ret << '\n';
  return 0;
}
