#include <bits/stdc++.h>
using namespace std;
int main() {
  int(n), (m);
  scanf("%d%d", &(n), &(m));
  int((a)[(n)]);
  for (int i = 0; i < (n); i++) scanf("%d", &((a)[i]));
  double ans = 0.0;
  for (int(i) = 0; (i) < (m); (i)++) {
    int(t1), (t2);
    scanf("%d%d", &(t1), &(t2));
    t1--;
    t2--;
    int(val);
    scanf("%d", &(val));
    if (double(a[t1] + a[t2]) / val - ans > 0)
      ans = double(a[t1] + a[t2]) / val;
  }
  printf("%.12lf\n", ans);
  return 0;
}
