#include <bits/stdc++.h>
using namespace std;
int node[501];
int n, m;
int main() {
  int i, j, a, b, c;
  double maximum = -1;
  cin >> n >> m;
  for (i = 0; i < n; i++) cin >> node[i + 1];
  for (i = 0; i < m; i++) {
    cin >> a >> b >> c;
    if ((node[a] + node[b]) / (double)c > maximum)
      maximum = (node[a] + node[b]) / (double)c;
  }
  if (maximum != -1)
    printf("%0.9lf\n", maximum);
  else
    cout << "0.0000000000\n";
  return 0;
}
