#include <bits/stdc++.h>
using namespace std;
const int N = 505;
const double eps = 1e-8;
int a[N];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  double ans = 0;
  for (int i = 0; i < m; i++) {
    int u, v, w;
    scanf("%d%d%d", &u, &v, &w);
    ans = max(ans, 1.0 * (a[u] + a[v]) / w);
  }
  printf("%.10lf\n", ans);
  return 0;
}
