#include <bits/stdc++.h>
using namespace std;
const int maxN = 505;
int v[maxN], n, m;
int main() {
  ios_base::sync_with_stdio(false);
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; ++i) scanf("%d", &v[i]);
  int x, y, c;
  double res = 0;
  for (int i = 1; i <= m; ++i) {
    scanf("%d%d%d", &x, &y, &c);
    res = max(res, 1.0 * (v[x] + v[y]) / c);
  }
  printf("%.10lf", res);
  return 0;
}
