#include <bits/stdc++.h>
using namespace std;
const int N = 1e9;
const double EPS = 1e-8;
double a[1001001];
vector<int> g[100100];
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> a[i + 1];
  }
  double ans = 0;
  for (int i = 0; i < m; i++) {
    int x, y, z;
    cin >> x >> y >> z;
    ans = max(ans, (double)(a[x] + a[y]) / z);
  }
  printf("%0.15lf", ans);
  return 0;
}
