#include <bits/stdc++.h>
using namespace std;
using ld = long double;
int n, m, a, b, t;
vector<pair<int, ld>> e[501];
ld v[501];
bool visited[501];
ld ans;
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; ++i) scanf("%d", &t), v[i] = t;
  while (m--)
    scanf("%d%d%d", &a, &b, &t), e[a].emplace_back(b, t),
        e[b].emplace_back(a, t);
  for (int i = 1; i <= n; ++i) {
    memset(visited, 0, sizeof visited);
    for (int j = 0; j < e[i].size(); ++j) {
      ans = max(ans, (v[i] + v[e[i][j].first]) / e[i][j].second);
    }
  }
  cout.precision(23);
  cout << ans;
}
