#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, m;
  cin >> n >> m;
  long long ar[n];
  for (long long i = 0; i < n; i++) cin >> ar[i];
  double ans = 0;
  long long a, b, c;
  for (long long i = 0; i < m; i++) {
    cin >> a >> b >> c;
    a = ar[a - 1];
    b = ar[b - 1];
    ans = max(ans, 1.0 * (a + b) / c);
  }
  cout << fixed << setprecision(9) << ans << '\n';
}
