#include <bits/stdc++.h>
using namespace std;
int n, m, w[505];
int adjmat[505][505];
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> w[i];
  }
  int a, b, c;
  for (int i = 0; i < m; i++) {
    cin >> a >> b >> c;
    a--, b--;
    adjmat[a][b] = adjmat[b][a] = c;
  }
  double ans = 0;
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      if (adjmat[i][j] != 0) {
        ans = max(ans, (double)(w[i] + w[j]) / (double)(adjmat[i][j]));
      }
    }
  }
  printf("%.11lf\n", ans);
}
