#include <bits/stdc++.h>
using namespace std;
int n, m;
int value[505];
int main() {
  scanf("%d%d", &n, &m);
  double ans = 0;
  for (int i = 1; i <= n; ++i) scanf("%d", &value[i]);
  for (int i = 0; i < m; ++i) {
    int a, b, c;
    scanf("%d%d%d", &a, &b, &c);
    double rt = (double(1.0) * (value[a] + value[b])) / (1.0 * c);
    if (rt > ans) ans = rt;
  }
  printf("%.15lf\n", ans);
  return 0;
}
