#include <bits/stdc++.h>
using namespace std;
int n, m, a, b, c;
int p[501];
double ans;
int main(void) {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", p + i);
  for (int i = 1; i <= m; i++) {
    scanf("%d%d%d", &a, &b, &c);
    ans = max(ans, (double)(p[a] + p[b]) / c);
  }
  printf("%.15f\n", ans);
}
