#include <bits/stdc++.h>
using namespace std;
const int INF = 2147483647;
template <class T>
int size(T &x) {
  return x.size();
}
double comp(int v, int e) {
  if (e == 0) return 0.0;
  return (double)v / e;
}
int main() {
  int n, m;
  scanf("%d %d\n", &n, &m);
  vector<int> w(n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &w[i]);
  }
  double mx = 0.0;
  for (int i = 0; i < m; i++) {
    int a, b, c;
    scanf("%d %d %d\n", &a, &b, &c);
    a--, b--;
    mx = max(mx, (double)(w[a] + w[b]) / c);
  }
  printf("%0.10lf\n", mx);
  return 0;
}
