#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) { return (b == 0 ? a : gcd(b, a % b)); }
int lcm(int a, int b) { return (a * (b / gcd(a, b))); }
int fx[] = {0, 0, 1, -1};
int fy[] = {-1, 1, 0, 0};
double a[10005];
int main() {
  int n, m, i, p, q;
  double ans, t, r;
  while (scanf("%d %d", &n, &m) != EOF) {
    ans = 0.0;
    for (i = 0; i < n; i++) scanf("%lf", &a[i]);
    if (m == 0) {
      printf("%.12lf\n", ans);
      continue;
    }
    for (i = 0; i < m; i++) {
      scanf("%d %d %lf", &p, &q, &r);
      t = (a[p - 1] + a[q - 1]) / r;
      if (t > ans) ans = t;
    }
    printf("%.12lf\n", ans);
  }
  return 0;
}
