#include <bits/stdc++.h>
using namespace std;
int p[505];
int n, m;
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> p[i];
  double res = 0;
  for (int i = 1, x, y, w; i <= m; i++) {
    cin >> x >> y >> w;
    res = max(res, (p[x] + p[y]) * 1.0 / w);
  }
  printf("%.9f\n", res);
}
