#include <bits/stdc++.h>
using namespace std;
vector<pair<long long int, long long int> > g[511];
bool del[511] = {0};
int main() {
  int N, m;
  cin >> N >> m;
  double ans = 0;
  int x[N];
  for (int i = 0; i < N; i++) cin >> x[i];
  int u, v, l;
  for (int i = 0; i < m; i++) {
    cin >> u >> v >> l;
    u--;
    v--;
    ans = max(ans, (double)(x[u] + x[v]) / (double)l);
  }
  printf("%.10f", ans);
}
