#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100010 * 2;
int w[MAXN];
int N, M;
int main() {
  while (cin >> N >> M) {
    for (int i = 1; i <= N; ++i) cin >> w[i];
    double ans = 0.0;
    while (M--) {
      int a, b, c;
      cin >> a >> b >> c;
      ans = max(ans, (0.0 + w[a] + w[b]) / c);
    }
    printf("%.15f\n", ans);
  }
  return 0;
}
