#include <bits/stdc++.h>
using namespace std;
vector<pair<int, double> > v[1100];
double x[1100];
int vi[1100];
int main() {
  int n, m, i;
  scanf("%d%d", &n, &m);
  for (i = 1; i < n + 1; i++) scanf("%lf", &x[i]);
  for (i = 1; i < m + 1; i++) {
    double c;
    int a, b;
    scanf("%d%d%lf", &a, &b, &c);
    v[a].push_back(make_pair(b, c));
    v[b].push_back(make_pair(a, c));
  }
  double an = 0;
  for (i = 1; i < n + 1; i++) {
    int j, l = v[i].size();
    for (j = 0; j < l; j++)
      an = max(an, (x[i] + x[v[i][j].first]) / v[i][j].second);
  }
  printf("%.12lf", an);
  return 0;
}
