#include <bits/stdc++.h>
using namespace std;
int n, m;
const int N = 510, M = 250000 + 10;
int v[N];
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; ++i) scanf("%d", v + i);
  double ans = 0;
  for (int i = 0; i < m; ++i) {
    int a, b, c;
    scanf("%d%d%d", &a, &b, &c);
    double t = double(v[a] + v[b]) / c;
    if (t > ans) ans = t;
  }
  printf("%.16lf", ans);
}
