#include <bits/stdc++.h>
using namespace std;
int p[505];
double kq;
int n, m;
int main() {
  scanf("%d%d", &n, &m);
  if (m == 0) {
    printf("%.9f", 0);
    return 0;
  }
  kq = 0;
  for (int i = 1; i <= n; i++) scanf("%d", &p[i]);
  for (int i = 0; i < m; i++) {
    int x, y, z;
    scanf("%d%d%d", &x, &y, &z);
    kq = max(kq, (p[x] + p[y]) / (double)z);
  }
  printf("%.9f", kq);
  return 0;
}
