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