#include <bits/stdc++.h>
using namespace std;
const int INF = 0x7fffffff;
const int maxn = 500 + 10;
int a[maxn];
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  double ans = 0;
  for (int i = 0; i < m; i++) {
    int x, y, z;
    cin >> x >> y >> z;
    double tem = 1.0 * (a[x] + a[y]) / z;
    ans = max(tem, ans);
  }
  cout.setf(ios::fixed);
  cout.precision(9);
  cout << ans << endl;
  return 0;
}
