#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  vector<double> a;
  for (int i = 0; i < n; i++) {
    int t;
    cin >> t;
    a.push_back(t);
  }
  double fa = 0;
  for (int i = 0; i < m; i++) {
    int t1, t2;
    double v;
    cin >> t1 >> t2 >> v;
    fa = max(fa, (a[t1 - 1] + a[t2 - 1]) / v);
  }
  cout << setprecision(14) << fa;
  return 0;
}
