#include <bits/stdc++.h>
using namespace std;
double tmp, ans;
int n, m, a[600];
int main() {
  int i, x, y, v;
  while (~scanf("%d%d", &n, &m)) {
    for (i = 1; i <= n; i++) {
      cin >> a[i];
    }
    ans = 0;
    for (i = 1; i <= m; i++) {
      cin >> x >> y >> v;
      tmp = 1.0 * (a[x] + a[y]) / (double)v;
      if (tmp > ans) ans = tmp;
    }
    printf("%.15f\n", ans);
  }
  return 0;
}
