#include <bits/stdc++.h>
using namespace std;
int a[510];
int main() {
  int T, n, m;
  double res = 0;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  while (m--) {
    int x, y, v;
    scanf("%d%d%d", &x, &y, &v);
    double t = (double)(a[x] + a[y]) / v;
    if (t > res) res = t;
  }
  printf("%.15lf\n", res);
  return 0;
}
