#include <bits/stdc++.h>
using namespace std;
const int N = 505;
int a[N], g[N][N];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  for (int i = 1, u, v, w; i <= m; i++) {
    scanf("%d%d%d", &u, &v, &w);
    g[u][v] = g[v][u] = w;
  }
  double ans = 0.0;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j < i; j++) {
      if (g[i][j] == 0) continue;
      if ((double)(a[i] + a[j]) / (g[i][j]) > ans) {
        ans = (double)(a[i] + a[j]) / (g[i][j]);
      }
    }
  }
  printf("%.10f\n", ans);
  return 0;
}
