#include <bits/stdc++.h>
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast")
using namespace std;
const int mod = 998244353;
inline void reduce(int& x) { x += x >> 31 & mod; }
inline int gi() {
  int f = 1, x = 0;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -f;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = (x << 1) + (x << 3) + ch - 48;
    ch = getchar();
  }
  return f ? x : -x;
}
const int N = 505;
int n, m;
double val[N];
int main() {
  n = gi(), m = gi();
  for (int i = (1); i <= (n); ++i) cin >> val[i];
  double ans = 0;
  for (int i = (1); i <= (m); ++i) {
    int u = gi(), v = gi(), w = gi();
    ans = max(ans, (val[u] + val[v]) / (1.0 * w));
  }
  cout << fixed << setprecision(10) << ans << endl;
  return 0;
}
