#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  double v[500 + 5];
  while (~scanf("%d %d", &n, &m)) {
    for (int i = 1; i <= n; i++) scanf("%lf", &v[i]);
    double ans = 0;
    int x, y;
    double edge;
    while (m--) {
      scanf("%d %d %lf", &x, &y, &edge);
      ans = max(ans, (v[x] + v[y]) / edge);
    }
    printf("%.12lf\n", ans);
  }
  return 0;
}
