#include <bits/stdc++.h>
using namespace std;
int n, m, data[510];
double ans;
int main() {
  scanf("%d%d", &n, &m);
  if (m == 0) {
    printf("%.9lf\n", 0);
    return 0;
  }
  for (int i = 1; i <= n; i++) scanf("%d", &data[i]);
  for (int i = 1, x, y, z; i <= m; i++) {
    scanf("%d%d%d", &x, &y, &z);
    ans = max(ans, (double)(data[x] + data[y]) / z);
  }
  printf("%.9lf", ans);
}
