#include <bits/stdc++.h>
using namespace std;
void solve(int test_case) {
  double ans = 0;
  int n, m;
  cin >> n >> m;
  int nodes[n + 1];
  for (int i = 0; i < n; ++i) {
    cin >> nodes[i + 1];
  }
  for (int i = 0; i < m; ++i) {
    int a, b, c;
    cin >> a >> b >> c;
    ans = max(ans, 1.0 * (nodes[a] + nodes[b]) / c);
  }
  cout << fixed << setprecision(15) << ans << '\n';
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int t = 1;
  for (int tc = 1; tc <= t; ++tc) solve(tc);
}
