#include <bits/stdc++.h>
using namespace std;
double V[502];
int main() {
  int n, m;
  double c;
  int u, v;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> V[i];
  double res = 0.0;
  for (int i = 0; i < m; i++) {
    cin >> u >> v >> c;
    res = max(res, (V[u] + V[v]) / c);
  }
  printf("%.15lf", res);
  return 0;
}
