#include <bits/stdc++.h>
using namespace std;
const int MAX_NB_NOEUDS = 501;
int nb_noeuds, nb_aretes;
int poids[MAX_NB_NOEUDS];
int main() {
  scanf("%d%d", &nb_noeuds, &nb_aretes);
  for (int i = 1; i <= nb_noeuds; i++) scanf("%d", &poids[i]);
  double densite_max = 0;
  for (int i = 1; i <= nb_aretes; i++) {
    int a, b, c;
    scanf("%d%d%d", &a, &b, &c);
    densite_max = max(densite_max, ((double)(poids[a] + poids[b])) / c);
  }
  printf("%0.15f\n", densite_max);
  return 0;
}
