#include <bits/stdc++.h>
using namespace std;
const long long mxn = 1000;
long long c[mxn];
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n, m;
  cin >> n >> m;
  for (long long i = 1; i <= n; i++) cin >> c[i];
  long double ans = 0.0;
  for (long long i = 1; i <= m; i++) {
    long long a, b, t;
    cin >> a >> b >> t;
    ans = max(ans, (long double)(c[a] + c[b] + 0.0) / (t * 1.0));
  }
  cout << fixed << setprecision(13) << ans << "\n";
  return 0;
}
