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