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