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