#include <bits/stdc++.h>
using namespace std;
int val[1000];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", &val[i]);
  int a, b, c;
  double ans = 0;
  for (int i = 1; i <= m; i++) {
    scanf("%d%d%d", &a, &b, &c);
    if ((val[a] + val[b]) / (double)c - 1e-10 > ans)
      ans = (val[a] + val[b]) / (double)c;
  }
  printf("%.15f", ans);
}
