#include <bits/stdc++.h>
using namespace std;
int n, m, lis[555], u, v, c;
double ans;
int main() {
  ios::sync_with_stdio(false);
  ans = 0.0;
  cin >> n >> m;
  for (long long i = (1); i <= (n); i++) cin >> lis[i];
  while (m--) {
    cin >> u >> v >> c;
    ans = max(ans, (lis[u] + lis[v]) * 1.0 / c);
  }
  cout << setprecision(11) << ans;
}
