#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, x, y, z;
  double max = 0, temp;
  cin >> n >> m;
  int a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < m; i++) {
    cin >> x >> y >> z;
    temp = (double)(a[x - 1] + a[y - 1]) / z;
    if (temp > max) max = temp;
  }
  printf("%.15f\n", max);
  return 0;
}
