#include <bits/stdc++.h>
using namespace std;
const int MN = 2e6;
int n, m, q;
int v[MN];
int f[1000][1000];
int main() {
  scanf("%d%d", &n, &m);
  int i, j, k;
  for (i = 1; i <= n; i++) scanf("%d", v + i);
  for (i = 1; i <= m; i++) {
    int a, b, c;
    scanf("%d%d%d", &a, &b, &c);
    f[a][b] = c;
    f[b][a] = c;
  }
  double ans = 0;
  for (i = 1; i <= n; i++)
    for (j = i + 1; j <= n; j++)
      if (f[i][j])
        if (double(v[i] + v[j]) / f[i][j] > ans)
          ans = double(v[i] + v[j]) / f[i][j];
  printf("%.12f\n", ans);
  return 0;
}
