#include <bits/stdc++.h>
using namespace std;
int adj[501][501], value[501];
int main() {
  int n, m;
  while (cin >> n >> m) {
    memset(adj, -1, sizeof(adj));
    for (int i = 1; i <= n; i++) cin >> value[i];
    while (m--) {
      int x, y, z;
      cin >> x >> y >> z;
      adj[x][y] = adj[y][x] = z;
    }
    double lmax = 0;
    for (int i = 1; i <= n; i++)
      for (int j = i + 1; j <= n; j++)
        if (adj[i][j] >= 0)
          lmax = max(lmax, (value[i] + value[j] + 0.0) / adj[i][j]);
    printf("%.9lf\n", lmax);
  }
  return 0;
}
