#include <bits/stdc++.h>
using namespace std;
double val[505];
struct node {
  int a, b;
  double val;
  double quan;
} p[250005];
bool cmp(node x, node y) { return x.quan > y.quan; }
int main() {
  int n, m, i, j;
  while (scanf("%d%d", &n, &m) != EOF) {
    for (i = 1; i <= n; i++) scanf("%lf", &val[i]);
    for (i = 1; i <= m; i++) {
      scanf("%d%d%lf", &p[i].a, &p[i].b, &p[i].val);
      p[i].quan = (val[p[i].a] + val[p[i].b]) / p[i].val;
    }
    sort(p + 1, p + 1 + m, cmp);
    if (m == 0)
      printf("%.10lf\n", 0);
    else
      printf("%.10lf\n", p[1].quan);
  }
}
