#include <bits/stdc++.h>
using namespace std;
int a[510];
int main() {
  int n, m;
  while (~scanf("%d%d", &n, &m)) {
    for (int i = 0; i < n; ++i) {
      scanf("%d", &a[i]);
    }
    double ans = 0;
    for (int i = 0; i < m; ++i) {
      int x, y, c;
      scanf("%d%d%d", &x, &y, &c);
      x--;
      y--;
      ans = max(ans, (1.0 * (a[x] + a[y])) / (1.0 * c));
    }
    printf("%.15f\n", ans);
  }
  return 0;
}
