#include <bits/stdc++.h>
using namespace std;
using namespace std;
const int mod = 1000000007;
const int INF = 1000000000;
const int N = 505;
using namespace std;
int n, m;
int x[N];
int g[N][N];
int main() {
  cin >> n >> m;
  memset(g, -1, sizeof(g));
  for (int i = 0; i < n; ++i) scanf("%d", &x[i]);
  int a, b, c;
  for (int i = 0; i < m; ++i) {
    cin >> a >> b >> c;
    --a;
    --b;
    g[a][b] = c;
    g[b][a] = c;
  }
  double dop;
  double ans = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      if (g[i][j] <= 0) continue;
      dop = (double)(x[i] + x[j]) / (double)g[i][j];
      ans = max(ans, dop);
    }
  }
  printf("%.12lf", ans);
  return 0;
}
