#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, a, b, c;
  double ans, g[1000];
  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> g[i];
  for (int j = 0; j < m; j++) {
    cin >> a >> b >> c;
    ans = max(ans, (g[a] + g[b]) / c);
  }
  printf("%.12lf\n", ans);
}
