#include <bits/stdc++.h>
int main() {
  long int n, m, x[1000010], a, b, c;
  long int i;
  double max;
  scanf("%ld%ld", &n, &m);
  for (i = 1; i <= n; i++) scanf("%ld", &x[i]);
  max = 0;
  while (m > 0) {
    scanf("%ld%ld%ld", &a, &b, &c);
    if (c > 0) {
      if (max < ((x[a] + x[b]) * 1.0 / c)) max = (x[a] + x[b]) * 1.0 / c;
    }
    m--;
  }
  printf("%.11lf\n", max);
  return 0;
}
