#include <bits/stdc++.h>
using namespace std;
const int MAXN = 505;
int n, m;
int v[MAXN];
int head[MAXN];
double e[MAXN * MAXN];
int a, b, c;
int main() {
  while (scanf("%d%d", &n, &m) != EOF) {
    for (int i = 1; i <= n; i++) scanf("%d", &v[i]);
    for (int i = 1; i <= m; i++) {
      scanf("%d%d%d", &a, &b, &c);
      e[i] = 1.0 * (v[a] + v[b]) / c;
    }
    double ans = 0.0;
    for (int i = 1; i <= m; i++) ans = max(ans, e[i]);
    printf("%.12lf\n", ans);
  }
  return 0;
}
