#include <bits/stdc++.h>
using namespace std;
const int MAX = 1111;
int a[MAX];
int main() {
  int n, m;
  while (cin >> n >> m) {
    int i, j;
    for (i = 1; i <= n; i++) {
      scanf("%d", &a[i]);
    }
    double ans = 0;
    while (m--) {
      int x, y, d;
      scanf("%d%d%d", &x, &y, &d);
      double tmp = (a[x] + a[y]) * 1.0 / d;
      if (tmp > ans) ans = tmp;
    }
    printf("%.10f\n", ans);
  }
  return 0;
}
