#include <bits/stdc++.h>
using namespace std;
int n, m;
int a[505];
double ans = 0.0;
int rd() {
  int f = 1, x = 0;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = (x << 3) + (x << 1) + (c ^ 48);
    c = getchar();
  }
  return f * x;
}
int main() {
  n = rd(), m = rd();
  for (int i = 1; i <= n; i++) a[i] = rd();
  for (int i = 1; i <= m; i++) {
    int u = rd(), v = rd(), w = rd();
    ans = max(ans, 1.0 * (a[u] + a[v]) / w);
  }
  printf("%.9f\n", ans);
  return 0;
}
