#include <bits/stdc++.h>
using namespace std;
long double a[500];
int main() {
  ios_base::sync_with_stdio(0);
  int n, m, x, y;
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> a[i];
  long double ans = 0;
  for (int i = 0; i < m; i++) {
    long double k;
    cin >> x >> y >> k;
    x--;
    y--;
    ans = max(ans, (a[x] + a[y]) / k);
  }
  cout << fixed << setprecision(9) << ans << endl;
  return 0;
}
