#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  vector<int> V(n);
  for (int i = 0; i < n; ++i) scanf("%d", &V[i]);
  double ret = 0;
  for (int i = 0; i < m; ++i) {
    int a, b, c;
    scanf("%d %d %d", &a, &b, &c);
    --a;
    --b;
    if (c == 0) continue;
    double tmp = (V[a] + V[b]) / double(c);
    ret = max(ret, tmp);
  }
  printf("%.9lf", ret);
  return 0;
}
