#include <bits/stdc++.h>
using namespace std;
const int N = 550;
int n, m, u, v;
double maxn, num[N], w;
int main() {
  ios::sync_with_stdio(false);
  while (cin >> n >> m) {
    memset(num, 0, sizeof num);
    double maxx = 0;
    for (int i = 1; i <= n; i++) cin >> num[i];
    for (int i = 0; i < m; i++) {
      cin >> u >> v >> w;
      maxx = max(maxx, (num[u] + num[v]) / (double)w);
    }
    cout << fixed << setprecision(15) << maxx << endl;
  }
  return 0;
}
