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