#include <bits/stdc++.h>
using namespace std;
long long int n, m, a, b, c, adjm[501][501], x[501];
double res = 0;
int main() {
  std::cin >> n >> m;
  for (long long int i = 0; i <= n; i++) {
    for (long long int j = 0; j <= n; j++) {
      adjm[i][j] = 1e17;
    }
  }
  for (long long int i = 1; i <= n; i++) {
    std::cin >> x[i];
    adjm[i][i] = 0;
  }
  for (long long int i = 0; i < m; i++) {
    std::cin >> a >> b >> c;
    adjm[a][b] = adjm[b][a] = c;
    res = (((res) > (1.0 * (x[a] + x[b] + 0.0) / c * 1.0))
               ? (res)
               : (1.0 * (x[a] + x[b] + 0.0) / c * 1.0));
  }
  std::cout << setprecision(10) << fixed << res << '\n';
}
