#include <bits/stdc++.h>
using namespace std;
double x[1000000 + 10];
int main() {
  double sum;
  int i, n, m, a, b, c;
  while (~scanf("%d%d", &n, &m)) {
    sum = 0;
    for (i = 1; i <= n; i++) scanf("%lf", &x[i]);
    if (m == 0)
      printf("%.15lf\n", sum);
    else {
      while (m--) {
        scanf("%d%d%d", &a, &b, &c);
        sum = max(sum, (x[a] + x[b]) / c);
      }
      printf("%.15lf\n", sum);
    }
  }
  return 0;
}
