#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, a, b;
  double c, ar[555], mx;
  while (cin >> n >> m) {
    for (int i = 1; i <= n; i++) cin >> ar[i];
    for (int i = 0; i < m; i++) {
      cin >> a >> b >> c;
      mx = max(mx, (ar[a] + ar[b]) / c);
    }
    printf("%.11lf\n", mx);
  }
}
