#include <bits/stdc++.h>
using namespace std;
int n;
double arr[550];
int m;
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> arr[i];
  double ans = 0;
  for (int i = 1; i <= m; i++) {
    int u, v;
    double w;
    cin >> u >> v;
    cin >> w;
    double rr = (arr[u] + arr[v]) / w;
    if (rr > ans) ans = rr;
  }
  printf("%.9lf\n", ans);
  return 0;
}
