#include <bits/stdc++.h>
using namespace std;
int n, m, a[200000], X[200000], Y[200000], C[200000];
int main() {
  scanf("%d%d", &n, &m);
  double ans = 0;
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= m; i++)
    scanf("%d%d%d", &X[i], &Y[i], &C[i]),
        ans = max(ans, 1.0 * (a[X[i]] + a[Y[i]]) / C[i]);
  printf("%.13f\n", ans);
}
