#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n, m;
  cin >> n >> m;
  double val[n + 1];
  for (int i = 1; i <= n; i++) cin >> val[i];
  double ans = 0;
  for (int i = 0; i < m; i++) {
    int x, y;
    double c;
    cin >> x >> y >> c;
    ans = max(ans, (val[x] + val[y]) / c);
  }
  printf("%.9f", ans);
}
