#include <bits/stdc++.h>
using namespace std;
const int MXN = 510;
const int INF = (int)1e9;
const long long LINF = (long long)1e18;
const int mod = 1000000007;
int x[MXN];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = (0); i < (n); i++) scanf("%d", &x[i]);
  double res = 0;
  for (int i = (0); i < (m); i++) {
    int a, b, c;
    scanf("%d%d%d", &a, &b, &c);
    res = max(res, double(x[a - 1] + x[b - 1]) / c);
  }
  printf("%.9lf", res);
}
