#include <bits/stdc++.h>
using namespace std;
const int maxn = 100020;
const int logn = 18;
const int MOd = 1e9 + 7;
int a, b;
int ar[maxn];
int main() {
  scanf("%d %d", &a, &b);
  for (int i = 1; i <= a; i++) scanf("%d", &ar[i]);
  double ans = 0.0;
  for (int i = 1, j, k, t; i <= b; i++) {
    scanf("%d %d %d", &j, &k, &t);
    ans = max(ans, ((double)(ar[j] + ar[k]) / t));
  }
  printf("%.12lf\n", ans);
  return 0;
}
