#include <bits/stdc++.h>
using namespace std;
const int N = 501;
int b[N], first, second, z, n, m, c[N][N];
vector<pair<int, int> > a[N];
long double ans;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> b[i];
  for (int i = 0; i < m; i++) {
    cin >> first >> second >> z;
    a[first].push_back(make_pair(second, z));
    a[second].push_back(make_pair(first, z));
    c[first][second] = z;
    c[second][first] = z;
  }
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) {
      if (i == j) continue;
      long double q = 0.;
      if (c[i][j] != 0) q = (b[i] + b[j] + 0.) / (c[i][j] + 0.);
      ans = max(ans, q);
    }
  cout.precision(9);
  cout << fixed << ans;
  ;
  return 0;
}
