#include <bits/stdc++.h>
using namespace std;
int n, m;
int x[555];
int adj[555][555];
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", x + i);
  for (int i = 1; i <= m; i++) {
    int u, v, c;
    scanf("%d%d%d", &u, &v, &c);
    adj[u][v] = adj[v][u] = c;
  }
  double ret = 0;
  for (int u = 1; u <= n; u++)
    for (int v = u + 1; v <= n; v++)
      if (adj[u][v]) ret = max(ret, double(x[u] + x[v]) / adj[u][v]);
  printf("%.10lf\n", ret);
  return 0;
}
