#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
int main() {
  double res = 0;
  int n, m;
  int a[maxn];
  cin >> n >> m;
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  for (int i = 0; i < m; i++) {
    int u, v, c;
    scanf("%d %d %d", &u, &v, &c);
    u--;
    v--;
    double t = 1.0 * (a[u] + a[v]) / c;
    res = max(res, t);
  }
  cout.precision(15);
  cout << res;
  return 0;
}
