#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, M;
  cin >> N >> M;
  vector<int> val(N);
  if (M == 0) {
    cout << 0 << endl;
    return 0;
  }
  for (int i = 0; i < N; i++) {
    cin >> val[i];
  }
  double mx = 0;
  for (int i = 0; i < M; i++) {
    long long a, b, c;
    cin >> a >> b >> c;
    a--;
    b--;
    if ((val[a] + (double)val[b]) / (double)c > mx)
      mx = (val[a] + (double)val[b]) / (double)c;
  }
  cout.precision(16);
  cout << mx << endl;
}
