#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, nv[502], x, y, z;
  vector<pair<int, int> > v[502];
  scanf("%d %d", &n, &m);
  for (int i = 0; i < n; i++) scanf("%d", &nv[i]);
  while (m--) {
    scanf("%d %d %d", &x, &y, &z);
    v[x - 1].push_back(pair<int, int>(y - 1, z));
    v[y - 1].push_back(pair<int, int>(x - 1, z));
  }
  long double ans = 0.0;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < v[i].size(); j++) {
      long double tmp = (long double)(nv[i] + nv[v[i][j].first]) /
                        (long double)v[i][j].second;
      ans = max(ans, tmp);
    }
  cout << setprecision(16) << ans << endl;
}
