#include <bits/stdc++.h>
using namespace std;
int n, m, a[510], u, v, c;
double k, res;
int main() {
  ios::sync_with_stdio(0);
  cin >> n >> m;
  for (int i = (1), _b = (n); i <= _b; i++) cin >> a[i];
  while (m--) {
    cin >> u >> v >> c;
    k = (a[u] + a[v]) / double(c);
    res = max(res, k);
  }
  printf("%0.9lf", res);
  return 0;
}
