#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline T abs(T t) {
  return t < 0 ? -t : t;
}
const unsigned long long modn = 1000000007;
inline unsigned long long mod(unsigned long long x) { return x % modn; }
int x[600];
int main() {
  int n, m, a, b, c, i;
  scanf("%d %d", &n, &m);
  for (i = 0; i < n; i++) scanf("%d", &x[i]);
  double mx = 0;
  for (i = 0; i < m; i++) {
    scanf("%d %d %d", &a, &b, &c);
    mx = max(mx, double(x[--a] + x[--b]) / double(c));
  }
  printf("%.15f\n", mx);
}
