#include <bits/stdc++.h>
using namespace std;
int n, m;
double v[505] = {0.0}, e[505][505] = {0.0};
int main(int argc, char *argv[]) {
  cin >> n >> m;
  double res = 0;
  for (int i = 1; i <= n; i++) cin >> v[i];
  for (int i = 1; i <= m; i++) {
    int x, y;
    double value;
    cin >> x >> y >> value;
    e[x][y] = value;
    e[y][x] = value;
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      if (i != j && e[i][j] > 0) res = max(res, (v[i] + v[j]) / e[i][j]);
    }
  }
  printf("%.9lf\n", res);
  return EXIT_SUCCESS;
}
