#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 523;
const int mod = (int)1e9 + 7;
int n, m;
int a[MAX_N];
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> a[i];
  double best = 0.0;
  for (int i = 1; i <= m; i++) {
    int u, v, cost;
    cin >> u >> v >> cost;
    best = max(best, 1.0 * (a[u] + a[v]) / cost);
  }
  printf("%.10f", best);
  return 0;
}
