#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-10;
const double PI = atan(1.0) * 4;
const int inf = ~0U >> 1;
const int Dx[] = {1, 0, -1, 0}, Dy[] = {0, 1, 0, -1};
template <class T>
bool chmin(T& a, const T& b) {
  return b < a ? a = b, 1 : 0;
}
template <class T>
bool chmax(T& a, const T& b) {
  return b > a ? a = b, 1 : 0;
}
template <class T>
int sgn(T first) {
  return (first > eps) - (first < -eps);
}
const int maxn = 505;
int v[maxn], g[maxn][maxn];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = (0); i <= (int)(n - 1); i++) scanf("%d", v + i);
  memset(g, -1, sizeof(g));
  for (int i = (0); i <= (int)(m - 1); i++) {
    int u, v, w;
    scanf("%d%d%d", &u, &v, &w);
    --u;
    --v;
    g[u][v] = g[v][u] = w;
  }
  double ans = 0;
  for (int i = (0); i <= (int)(n - 1); i++)
    for (int j = (0); j <= (int)(n - 1); j++)
      if (i != j && ~g[i][j]) {
        chmax(ans, (v[i] + v[j] + 0.0) / g[i][j]);
      }
  printf("%.10f\n", ans);
  return 0;
}
