#include <bits/stdc++.h>
using namespace std;
long long v[1123456];
int32_t main() {
  cin.tie(NULL);
  ios::sync_with_stdio(false);
  cout << setprecision(11) << fixed;
  long long n, m;
  cin >> n >> m;
  long double ans = 0;
  for (long long i = 0; i < n; i++) cin >> v[i];
  for (long long i = 0; i < m; i++) {
    long long a, b, c;
    cin >> a >> b >> c;
    a--;
    b--;
    ans = max(ans, ((long double)v[a] + v[b]) / c);
  }
  cout << ans << endl;
  return 0;
}
