#include <bits/stdc++.h>
using namespace std;
int weights[501];
int main() {
  ios_base::sync_with_stdio(false);
  cout.precision(30);
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < n; ++i) cin >> weights[i];
  double res = 0;
  for (int i = 0; i < m; ++i) {
    int a, b, c;
    cin >> a >> b >> c;
    --a;
    --b;
    double t = (weights[a] + weights[b]) * 1.0 / c;
    if (t > res) res = t;
  }
  cout << res << endl;
  return 0;
}
