#include <bits/stdc++.h>
using namespace std;
const int Maxn = 500;
int N, M;
int A[Maxn + 5];
int main() {
  double ans = 0;
  scanf("%d %d", &N, &M);
  for (int i = 1; i <= N; i++) scanf("%d", &A[i]);
  for (int i = 1; i <= M; i++) {
    int u, v, w;
    scanf("%d %d %d", &u, &v, &w);
    ans = max(ans, 1.0 * (A[u] + A[v]) / w);
  }
  printf("%.9f\n", ans);
  return 0;
}
