#include <bits/stdc++.h>
using namespace std;
const int MAXN = 5e2 + 10;
int n, m;
int w[MAXN];
int main() {
  scanf("%d%d", &n, &m);
  for (int ii = 1; ii <= n; ii++) scanf("%d", &w[ii]);
  double ans = 0;
  for (int ii = 0; ii < m; ii++) {
    int a, b, c;
    scanf("%d%d%d", &a, &b, &c);
    ans = max(ans, (w[a] + w[b]) * 1.0 / c);
  }
  printf("%.15f", ans);
}
