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