#include <bits/stdc++.h>
using namespace std;
int n, m;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout << fixed << setprecision(12);
  cin >> n >> m;
  vector<int> x(n);
  for (int i = 0; i < n; ++i) cin >> x[i];
  double ans = 0;
  for (int i = 0; i < m; ++i) {
    int a, b, c;
    cin >> a >> b >> c;
    --a, --b;
    ans = max(ans, (double)(x[a] + x[b]) / c);
  }
  cout << ans;
  return 0;
}
