#include <bits/stdc++.h>
using namespace std;
int n, m, x, y, a[550];
double ans, z;
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (int i = 1; i <= m; i++) {
    cin >> x >> y >> z;
    ans = max(ans, (a[x] + a[y]) / z);
  }
  cout << setprecision(9) << fixed << ans;
  return 0;
}
