#include <bits/stdc++.h>
using namespace std;
inline int read();
const int N = 1e6 + 2;
int n, m;
int v[N];
long double ans;
void Work() {
  n = read(), m = read();
  for (int i = 1; i <= n; ++i) v[i] = read();
  for (int i = 1; i <= m; ++i) {
    int s = read(), t = read();
    long double e = (v[s] + v[t]) * 1.0, w = (long double)read();
    ans = max(ans, e / w);
  }
  cout << setprecision(15) << ans << endl;
}
int main() {
  Work();
  return 0;
}
inline int read() {
  char c;
  bool type = 1;
  while ((c = getchar()) < '0' || c > '9')
    if (c == '-') type = 0;
  int ans = c ^ 48;
  while ((c = getchar()) >= '0' && c <= '9')
    ans = (ans << 3) + (ans << 1) + (c ^ 48);
  return type ? ans : -ans;
}
