#include <bits/stdc++.h>
using namespace std;
int n, m;
double val[511] = {};
void init() {
  double ans = 0, c;
  int l, r;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%lf", &val[i]);
  for (int i = 1; i <= m; i++) {
    scanf("%d%d%lf", &l, &r, &c);
    ans = max(ans, (val[l] + val[r]) / c);
  }
  printf("%.15lf", ans);
  return;
}
int main() {
  init();
  return 0;
}
