#include <bits/stdc++.h>
using namespace std;
double x[100000];
int main() {
  ios_base::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> x[i];
  double ans = 0;
  for (int i = 1; i <= m; i++) {
    int fi, se, we;
    cin >> fi >> se >> we;
    ans = max(ans, (x[fi] + x[se]) / (double)(we));
  }
  if (n == 1) {
    cout << "0.0000000000" << endl;
    return 0;
  }
  cout << fixed << setprecision(10) << ans << endl;
}
