#include <bits/stdc++.h>
using namespace std;
int n, m;
double val[505], mm[505][505];
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) {
    scanf("%lf", &val[i]);
  }
  int u, v;
  double w;
  memset(mm, -1, sizeof(mm));
  for (int i = 1; i <= m; i++) {
    scanf("%d%d%lf", &u, &v, &w);
    mm[u][v] = mm[v][u] = w;
  }
  double ans = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      if (i == j) continue;
      ans = max(ans, (val[i] + val[j]) / mm[i][j]);
    }
  }
  printf("%.10lf\n", ans);
  return 0;
}
