#include <bits/stdc++.h>
using namespace std;
const int N = 505;
int v[N];
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> v[i];
  double ans = 0;
  for (int i = 0; i < m; i++) {
    int x, y, c;
    cin >> x >> y >> c;
    if (ans < 1.0 * (v[x] + v[y]) / c) ans = 1.0 * (v[x] + v[y]) / c;
  }
  printf("%.12lf", ans);
  return 0;
}
