#include <bits/stdc++.h>
using namespace std;
template <class T1, class T2>
inline istream& operator>>(istream& fin, pair<T1, T2>& pr) {
  fin >> pr.first >> pr.second;
  return fin;
}
template <class T0, class T1, class T2>
inline istream& operator>>(istream& fin, tuple<T0, T1, T2>& t) {
  fin >> get<0>(t) >> get<1>(t) >> get<2>(t);
  return fin;
}
template <class T>
inline istream& operator>>(istream& fin, vector<T>& a) {
  for (auto& u : a) fin >> u;
  return fin;
}
double a444() {
  size_t n, m;
  cin >> n >> m;
  vector<int> a(n);
  cin >> a;
  double val = 0;
  for (size_t i = 0; i < m; ++i) {
    size_t u, v;
    int cost;
    cin >> u >> v >> cost;
    if (cost != 0) val = max(val, (a[u - 1] + a[v - 1]) / (double)cost);
  }
  return val;
}
int main(const int argc, char* argv[]) {
  cout << setprecision(15) << a444();
  return EXIT_SUCCESS;
}
