#include <bits/stdc++.h>
using namespace std;
const int MAXN = 503;
const int MAXM = 124753;
int N, M;
double val[MAXN], sol;
void read() {
  int a, b;
  double cost;
  cin >> N >> M;
  for (int i = 1; i <= N; ++i) cin >> val[i];
  for (int i = 0; i < M; ++i) {
    cin >> a >> b >> cost;
    if ((val[a] + val[b]) / cost > sol) sol = (val[a] + val[b]) / cost;
  }
}
int main() {
  read();
  cout << setprecision(9) << fixed << sol;
  return 0;
}
