#include <bits/stdc++.h>
using namespace std;
const int maxn = 510;
int n, m, a[maxn];
double ans;
int main() {
  ans = 0;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", a + i);
  for (int j = 0; j < m; j++) {
    int u, v, w;
    scanf("%d%d%d", &u, &v, &w);
    ans = max(ans, ((double)a[u] + a[v]) / (double)w);
  }
  printf("%.12lf\n", ans);
}
