#include <bits/stdc++.h>
using namespace std;
int n, m, e[505][505], v[505];
double mx, crt;
int main() {
  int i, j, k;
  cin >> n >> m;
  for (i = 1; i <= n; ++i) cin >> v[i];
  while (m--) {
    cin >> i >> j >> k;
    e[i][j] = k;
  }
  for (i = 1; i < n; ++i)
    for (j = i + 1; j <= n; ++j)
      if (e[i][j]) {
        crt = 1.0 * (v[i] + v[j]) / e[i][j];
        mx = max(mx, crt);
      }
  cout << setprecision(12) << fixed << mx << "\n";
  return 0;
}
