#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (ch > '9' || ch < '0') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
int n, m;
int v[505];
int main() {
  n = read();
  m = read();
  double ans = 0;
  for (int i = 1; i <= n; i++) v[i] = read();
  for (int i = 1; i <= m; i++) {
    int a = read(), b = read(), c = read();
    ans = max(ans, double(v[a] + v[b]) / c);
  }
  printf("%.10f", ans);
  return 0;
}
