#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  double a[n];
  for (int i = 0; i < n; i++) {
    a[i] = 0;
    cin >> a[i];
  }
  double result = 0;
  for (int i = 0; i < m; i++) {
    int p, q;
    double c;
    cin >> p >> q >> c;
    if ((a[p - 1] + a[q - 1]) / c > result) {
      result = (a[p - 1] + a[q - 1]) / c;
    }
  }
  printf("%.12f", result);
  return 0;
}
