#include <bits/stdc++.h>
using namespace std;
int v[505];
int main() {
  double ans;
  int n, m, x, y, z;
  while (scanf("%d%d", &n, &m) != EOF) {
    memset(v, 0, sizeof(v));
    for (int i = 1; i <= n; i++) scanf("%d", &v[i]);
    ans = 0;
    for (int i = 0; i < m; i++) {
      scanf("%d%d%d", &x, &y, &z);
      ans = max(ans, 1.0 * (v[x] + v[y]) / z);
    }
    printf("%.15f\n", ans);
  }
  return 0;
}
