#include <bits/stdc++.h>
using namespace std;
int x[505];
int n, m;
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", &x[i]);
  double ans = 0;
  int a1, b1, c1;
  for (int i = 0; i < m; i++) {
    scanf("%d%d%d", &a1, &b1, &c1);
    ans = max(ans, ((double)x[a1] + (double)x[b1]) / (double)c1);
  }
  printf("%.10lf\n", ans);
}
