#include <bits/stdc++.h>
using namespace std;
int main(void) {
  double ans = 0, temp;
  int n, m;
  cin >> n >> m;
  int val[n];
  for (int i = 0; i < n; ++i) cin >> val[i];
  int a, b, c;
  for (int i = 0; i < m; ++i) {
    cin >> a >> b >> c;
    temp = (double)(val[a - 1] + val[b - 1]) / c;
    if (temp > ans) ans = temp;
  }
  printf("%.15lf", ans);
  return 0;
}
