#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-9;
const int MAXN = 666666;
const int MOD = 1e9 + 7;
const int INF = (1 << 31);
int n, m, x[666], a, b, len, bestup = 0, bestdown = 1;
int main() {
  scanf("%d%d", &n, &m);
  for (size_t i = 0; i < n; ++i) {
    scanf("%d", &x[i + 1]);
  }
  for (size_t i = 0; i < m; ++i) {
    scanf("%d%d%d", &a, &b, &len);
    int up = x[a] + x[b], down = len;
    if (bestup * 1LL * down < up * 1LL * bestdown) bestup = up, bestdown = down;
  }
  printf("%.15lf", (double)bestup / (double)bestdown);
  return 0;
}
