#include <bits/stdc++.h>
using namespace std;
int val[507];
int n, m;
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; ++i) cin >> val[i];
  double ans = 0.0;
  for (int i = 0; i < m; ++i) {
    int a, b, c;
    cin >> a >> b >> c;
    --a, --b;
    ans = max(ans, (0.0 + val[a] + val[b]) / (double)c);
  }
  cout.precision(15);
  cout << fixed << ans;
  return 0;
}
