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