#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, a, b, c;
  scanf("%d %d", &n, &m);
  int arr[n + 1];
  for (int i = 1; i <= n; i++) scanf("%d", &arr[i]);
  double max = 0.0;
  while (m--) {
    scanf("%d %d %d", &a, &b, &c);
    if (((double)(arr[a] + arr[b]) / (double)c) > max)
      max = ((double)(arr[a] + arr[b]) / (double)c);
  }
  printf("%.10lf\n", max);
}
