#include <bits/stdc++.h>
using namespace std;
int w[600];
int main() {
  int n, m, a, b, c;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &w[i]);
  }
  double an = 0.0;
  for (int i = 1; i <= m; i++) {
    scanf("%d%d%d", &a, &b, &c);
    an = max(an, ((double)(w[a] + w[b])) / (double)(c));
  }
  printf("%.10lf", an);
}
