#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
const ll OO = 1e8;
int di[8] = {0, 0, 1, -1, -1, 1, -1, 1};
int dj[8] = {1, -1, 0, 0, 1, 1, -1, -1};
string ys = "YES", no = "NO";
const long double dgr = acos(-1) / 180, dg = 180 / acos(-1);
const int mod = 1e18, N = 2e5, M = 50000;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int n, m;
  cin >> n >> m;
  int a, b, c;
  double ans = 0;
  vector<int> v(n);
  for (auto& i : v) cin >> i;
  while (m--) {
    cin >> a >> b >> c;
    ans = max(ans, (double)(v[a - 1] + v[b - 1]) / c);
  }
  cout << fixed << setprecision(15) << ans << '\n';
  return 0;
}
