#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, f = 1;
  char c = getchar();
  while (!isdigit(c)) {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (isdigit(c)) {
    x = x * 10 + c - '0';
    c = getchar();
  }
  return x * f;
}
const int maxn = 505;
const int maxm = maxn * maxn;
int n, m, a[maxn], from[maxm], to[maxm], w[maxm];
double ans = 0;
int main() {
  n = read(), m = read();
  for (int i = 1; i <= n; i++) a[i] = read();
  for (int i = 1; i <= m; i++) {
    from[i] = read(), to[i] = read(), w[i] = read();
    ans = max(ans, 1.0 * (a[from[i]] + a[to[i]]) / w[i]);
  }
  printf("%.12f\n", ans);
  return 0;
}
