#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, arr[505], l, r, w;
  long double ans = 0;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> arr[i];
  for (int i = 1; i <= m; i++) {
    cin >> l >> r >> w;
    ans = max(ans, (long double)1.0 * (arr[l] + arr[r]) / w);
  }
  cout << fixed << setprecision(15) << ans << '\n';
  return 0;
}
