#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  double arr[n + 1], ans = 0;
  for (int i = 1; i <= n; i++) cin >> arr[i];
  int a, b;
  double x;
  for (int i = 0; i < m; i++) {
    cin >> a >> b >> x;
    ans = max(ans, (arr[a] + arr[b]) / x);
  }
  cout << fixed << setprecision(15) << ans << endl;
  return 0;
}
