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