#include <bits/stdc++.h>
using namespace std;
const int maxn = 500 + 10;
int n, m;
int val[maxn], G[maxn][maxn];
int main() {
  memset(G, 0x3f, sizeof(G));
  cin >> n >> m;
  double ans = 0;
  for (int i = 1; i <= n; ++i) scanf("%d", &val[i]);
  for (int i = 1; i <= m; ++i) {
    int u, v, w;
    scanf("%d%d%d", &u, &v, &w);
    G[v][u] = G[u][v] = w;
  }
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= n; ++j)
      if (G[i][j] != 0x3f3f3f3f)
        ans = max(ans, (double)(val[i] + val[j]) / G[i][j]);
  printf("%.15lf", ans);
  return 0;
}
