#include <bits/stdc++.h>
using namespace std;
template <class T1, class T2>
ostream& operator<<(ostream& out, pair<T1, T2> pair) {
  return out << "(" << pair.first << ", " << pair.second << ")";
}
template <class T>
void _printcoll(T const& coll) {
  int first = 1;
  cout << "[";
  for (auto a : coll) {
    if (!first) printf(", ");
    cout << a;
    first = false;
  }
  cout << "]" << endl;
}
template <class T>
void _printcoll(T const& coll, int len) {
  int first = 1;
  cout << "[";
  for (auto a : coll) {
    if (!first) printf(", ");
    cout << a;
    first = false;
    len--;
    if (!len) break;
  }
  cout << "]" << endl;
}
vector<pair<int, int> > adj[505];
int values[505];
int main() {
  double ans = 0;
  int N, M;
  cin >> N >> M;
  for (int i = 1; i <= N; i++) cin >> values[i];
  for (int i = 1; i <= M; i++) {
    int u, v, c;
    cin >> u >> v >> c;
    adj[u].push_back(pair<int, int>(v, c));
    adj[v].push_back(pair<int, int>(u, c));
  }
  for (int i = 1; i <= N; i++) {
    int sz = adj[i].size();
    for (int j = 0; j < sz; j++) {
      int v = adj[i][j].first;
      ans = max(ans, (values[i] + values[v]) * 1.0 / adj[i][j].second);
    }
  }
  printf("%.9lf\n", ans);
  return 0;
}
