#include <bits/stdc++.h>
using namespace std;
int V[505];
int N, M;
int main() {
  double maxim = 0;
  cin >> N >> M;
  for (int i = 1; i <= N; i++) cin >> V[i];
  int x, y, c;
  for (int i = 1; i <= M; i++) {
    cin >> x >> y >> c;
    maxim = max(maxim, (double)(V[x] + V[y]) / c);
  }
  cout << setprecision(16) << maxim;
}
