#include <bits/stdc++.h>
using namespace std;
const int INF = 2147483647;
int n, m, waga[505], a, b, c, i;
double best, wyn;
int main() {
  scanf("%d %d", &n, &m);
  for (i = 0; i < n; i++) scanf("%d", &waga[i]);
  best = 0.0;
  while (m--) {
    scanf("%d %d %d", &a, &b, &c);
    a--;
    b--;
    wyn = (waga[a] + waga[b]) * 1.0 / c;
    best = max(best, wyn);
  }
  printf("%.10lf\n", best);
  return 0;
}
