#include <bits/stdc++.h>
using namespace std;
int i, j, k, n, a, b, c, m, arr[99999];
double maxx;
int main() {
  cin >> n >> m;
  for (i = 1; i <= n; i++) cin >> arr[i];
  for (i = 1; i <= m; i++) {
    cin >> a >> b >> c;
    maxx = max(maxx, 1.0 * (arr[a] + arr[b]) / c);
  }
  printf("%.9lf", maxx);
}
