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