#include <bits/stdc++.h>
using namespace std;
using pii = pair<int, int>;
using ll = long long;
using ld = long double;
using cd = complex<ld>;
int main() {
  ios_base::sync_with_stdio(0);
  cout.tie(0);
  cin.tie(0);
  cout.precision(20);
  cout << fixed;
  int n, m;
  cin >> n >> m;
  vector<ld> v(n);
  for (ld &e : v) {
    cin >> e;
  }
  ld ans = 0;
  for (int i = 0; i < m; i++) {
    int a, b, c;
    cin >> a >> b >> c;
    a--;
    b--;
    ans = max(ans, (v[a] + v[b]) / c);
  }
  cout << ans;
};
