#include <bits/stdc++.h>
using namespace std;
unsigned N, M;
vector<unsigned> V;
double dens(const unsigned idxV1, const unsigned idxV2, const unsigned eW) {
  if (eW == 0) {
    return 0;
  }
  return (double)(V[idxV1] + V[idxV2]) / (double)eW;
}
int main() {
  unsigned v1, v2, w, n, m;
  double densidad;
  double max = 0;
  cout << setprecision(20);
  cin >> N;
  cin >> M;
  V = vector<unsigned>(N);
  for (n = 0; n < N; n++) {
    cin >> w;
    V[n] = w;
  }
  for (m = 0; m < M; m++) {
    cin >> v1;
    cin >> v2;
    cin >> w;
    v1--;
    v2--;
    densidad = dens(v1, v2, w);
    if (densidad > max) {
      max = densidad;
    }
  }
  cout << max << endl;
  return 0;
}
