#include <bits/stdc++.h>
using namespace std;
int v[510];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", &v[i]);
  int ansv = 0, anse = 0;
  for (int i = 1; i <= m; i++) {
    int a, b, e;
    scanf("%d%d%d", &a, &b, &e);
    if (ansv == 0 && anse == 0) {
      ansv = v[a] + v[b];
      anse = e;
    } else if (ansv * e < (v[a] + v[b]) * anse) {
      ansv = v[a] + v[b];
      anse = e;
    }
  }
  double f = 0.0;
  if (anse == 0)
    printf("%.10lf\n", f);
  else
    printf("%.10lf\n", (double)ansv / (double)anse);
  return 0;
}
