#include <bits/stdc++.h>
long n, m, x, y, i, a[1000], z;
double aa, bb, sum;
int main() {
  scanf("%ld%ld", &n, &m);
  for (i = 1; i <= n; i++) scanf("%ld", &a[i]);
  sum = 0;
  for (i = 1; i <= m; i++) {
    scanf("%ld%ld%ld", &x, &y, &z);
    aa = a[x] + a[y];
    bb = z;
    if (aa / bb > sum) {
      sum = aa / bb;
    }
  }
  printf("%0.15lf", sum);
}
