#include <bits/stdc++.h>
using namespace std;
double a[10100];
int main() {
  int n, m;
  cin >> n >> m;
  double ans = 0.0;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= m; i++) {
    int aa, bb;
    double cc;
    cin >> aa >> bb >> cc;
    ans = max((a[aa] + a[bb]) / cc, ans);
  }
  cout << fixed << setprecision(15) << ans << endl;
  return 0;
}
