#include <bits/stdc++.h>
using namespace std;
int i, n, m, x, y, z, a[505];
double rs;
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> m;
  for (i = 1; i <= n; ++i) cin >> a[i];
  for (i = 1; i <= m; ++i) {
    cin >> x >> y >> z;
    rs = max(rs, 1.0 * (a[x] + a[y]) / (1.0 * z));
  }
  cout << setprecision(9) << fixed << rs << '\n';
  return 0;
}
