#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 6;
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  int m;
  cin >> m;
  int Arr[n + 2];
  for (int i = 1; i <= n; i++) cin >> Arr[i];
  double Res = 0.0;
  while (m--) {
    int u, v;
    cin >> u >> v;
    double c;
    cin >> c;
    Res = max(Res, (1.0 * (Arr[u] + Arr[v])) / c);
  }
  cout << fixed;
  cout << setprecision(10);
  cout << Res << "\n";
}
