#include <bits/stdc++.h>
using namespace std;
int const N = 1234;
int n, m;
double wagi[N], ans;
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; ++i) scanf("%lf", &wagi[i]);
  int a, b, c;
  for (int i = 0; i < m; ++i) {
    scanf("%d%d%d", &a, &b, &c);
    if (ans < (wagi[a] + wagi[b]) / c) ans = (wagi[a] + wagi[b]) / c;
  }
  printf("%.15lf", ans);
  return 0;
}
