#include <bits/stdc++.h>
using namespace std;
int x[505];
int main() {
  int n, m, a, b, c, s;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> x[i];
  double ans = 0;
  for (int i = 1; i <= m; i++) {
    cin >> a >> b >> c;
    double s = (double)(x[a] + x[b]) / (double)c;
    if (s > ans) ans = s;
  }
  printf("%.9lf\n", ans);
  return 0;
}
