#include <bits/stdc++.h>
using namespace std;
double res;
int n, m, a[555], x, y, z;
int main() {
  scanf("%d%d", &n, &m);
  for (int i = (1), _b = (n); i <= _b; i++) scanf("%d", &a[i]);
  res = 0;
  for (int i = (1), _b = (m); i <= _b; i++) {
    scanf("%d%d%d", &x, &y, &z);
    res = max(res, double(a[x] + a[y]) / z);
  }
  printf("%.9lf", res);
  return 0;
}
