#include <bits/stdc++.h>
using namespace std;
void solve() {}
const long long maxn = 505;
long long x[maxn];
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cerr << fixed << setprecision(10);
  cout << fixed << setprecision(10);
  long long n, m;
  cin >> n >> m;
  for (long long i = 1; i <= n; i++) {
    cin >> x[i];
  }
  long double ans = 0;
  for (long long i = 1; i <= m; i++) {
    long long a, b, c;
    cin >> a >> b >> c;
    long double loc = ((long double)x[a] + x[b]) / (long double)c;
    ans = max(ans, loc);
  }
  cout << ans << '\n';
}
