#include <bits/stdc++.h>
const int INF = 1001001001;
const int dx[8] = {0, 0, 1, -1, 1, 1, -1, -1},
          dy[8] = {1, -1, 0, 0, 1, -1, 1, -1};
int V, E;
int ns[500];
std::vector<std::pair<int, int> > G[500];
int main() {
  std::cin >> V >> E;
  for (int i = (0); i < (V); i++) {
    std::cin >> ns[i];
  }
  for (int i = (0); i < (E); i++) {
    int u, v, cost;
    std::cin >> u >> v >> cost;
    u -= 1;
    v -= 1;
    G[u].push_back(std::make_pair(v, cost));
    G[v].push_back(std::make_pair(u, cost));
  }
  double res = 0.0;
  for (int i = (0); i < (V); i++) {
    for (auto e : G[i]) {
      if (e.second == 0) {
        continue;
      }
      res = std::max(res, 1. * (ns[i] + ns[e.first]) / e.second);
    }
  }
  printf("%.10f\n", res);
}
