#include <bits/stdc++.h>
using namespace std;
const int N = 505;
int a[N];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  int u, v, c;
  double res = 0;
  for (int i = 0; i < m; i++) {
    scanf("%d%d%d", &u, &v, &c);
    double tam = ((double)a[u] + a[v]) / c;
    res = (res < tam) ? tam : res;
  }
  printf("%.9lf", res);
}
