#include <bits/stdc++.h>
using namespace std;
bool done[1666];
int n;
double g[1666][1666], g2[1666][1666], d[1666];
double v[1666];
int m;
int x[1666 * 4444], y[1666 * 5555];
int dd[999];
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> v[i];
  double ans = 0;
  for (int i = 0; i < m; i++) {
    int a, b;
    double c;
    cin >> a >> b >> c;
    ans = max(ans, (v[a] + v[b]) / c);
  }
  printf("%.10f\n", ans);
}
