#include <bits/stdc++.h>
using namespace std;
const long long INF = 1000000005;
const long long MOD = 1000000007;
double X[505];
int M, N;
int main() {
  cin >> N >> M;
  for (int i = (1); i <= (N); i++) cin >> X[i];
  double ans = 0;
  while (M--) {
    double c;
    int a, b;
    cin >> a >> b >> c;
    ans = max(ans, (X[a] + X[b]) / c);
  }
  cout << setprecision(12) << fixed << ans << "\n";
}
