#include <bits/stdc++.h>
using namespace std;
struct Edge {
  int v1, v2, c;
  double ans;
} e[300100];
int v[300100];
bool comp(const Edge a, const Edge b) { return a.ans > b.ans; }
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    scanf("%d", v + i);
  }
  int a, b, c;
  for (int i = 1; i <= m; i++) {
    scanf("%d %d %d", &a, &b, &c);
    e[i].v1 = v[a];
    e[i].v2 = v[b];
    e[i].c = c;
    e[i].ans = (double)1.0 * (v[a] + v[b]) / c;
  }
  sort(e + 1, e + 1 + m, comp);
  double ans = 0.0;
  if (m > 0) ans = max(ans, e[1].ans);
  printf("%.15f\n", ans);
}
