#include <bits/stdc++.h>
const int N = 500 + 10;
int e[N][N];
int v[N];
int main() {
  int n, m;
  int x, y, z;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; ++i) scanf("%d", &v[i]);
  while (m-- > 0) {
    scanf("%d%d%d", &x, &y, &z);
    e[x][y] = e[y][x] = z;
  }
  double ans = 0;
  for (int i = 1; i <= n; ++i)
    for (int j = i + 1; j <= n; ++j)
      if (e[i][j] != 0) {
        double up = v[i] + v[j];
        double down = e[i][j];
        ans = std::max(ans, up / down);
      }
  printf("%.11f\n", ans);
  return 0;
}
