#include <bits/stdc++.h>
using namespace std;
const int maxn = 555;
const int maxm = 255555;
int val[maxn], a[maxm], b[maxm], c[maxm];
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &val[i]);
  }
  double answer = 0.0;
  for (int i = 1; i <= m; i++) {
    scanf("%d %d %d", &a[i], &b[i], &c[i]);
  }
  for (int i = 1; i <= m; i++) {
    answer = max(answer, (1.0 * val[a[i]] + val[b[i]]) / c[i]);
  }
  printf("%.11f\n", answer);
}
