#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, num[550];
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", &num[i]);
  double res = 0;
  int a, b, c;
  for (int i = 0; i < m; i++) {
    scanf("%d %d %d", &a, &b, &c);
    res = max(res, (double)(num[a] + num[b]) / c);
  }
  printf("%.15lf\n", res);
}
