#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const double EPS = 0.0000001;
const double PI = 3.141592653589793;
const int MAX_N = 200005;
const long long LLINF = 99999999999999999LL;
int N, M;
int val[MAX_N], A[MAX_N][4];
inline int double_cmp(double a, double b) {
  if (a - b < -EPS) return -1;
  if (a - b > EPS) return 1;
  return 0;
}
int main() {
  cin >> N >> M;
  for (int i = 1; i <= N; ++i) cin >> val[i];
  for (int i = 1; i <= M; ++i) cin >> A[i][0] >> A[i][1] >> A[i][2];
  double ans = 0;
  for (int i = 1; i <= M; ++i) {
    int x = A[i][0], y = A[i][1], c = A[i][2], sum = 0;
    sum = val[x] + val[y];
    double now = (double)sum / c;
    if (double_cmp(now, ans) == 1) ans = now;
  }
  printf("%.9lf\n", ans);
  return 0;
}
