#include <bits/stdc++.h>
using namespace std;
int A[501];
int main() {
  double ans = 0;
  int n, m, a, b, c;
  cin >> n >> m;
  for (int i = 1; i < n + 1; i++) cin >> A[i];
  for (int i = 0; i < m; i++) {
    cin >> a >> b >> c;
    ans = max(ans, (1.0 * (A[a] + A[b])) / (1.0 * c));
  }
  printf("%.13lf", ans);
  return 0;
}
