#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, x, y, c;
  int a[555];
  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> a[i];
  double ans = 0.0;
  while (m--) {
    cin >> x >> y >> c;
    ans = max(ans, ((a[x] + a[y] + 0.0) / c));
  }
  printf("%.15lf", ans);
  return 0;
}
