#include <bits/stdc++.h>
using namespace std;
int n, m, x, y, z, mm[505][505], mn[505];
double sol;
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; ++i) {
    cin >> mn[i];
  }
  sol = 0;
  for (int i = 1; i <= m; ++i) {
    cin >> x >> y >> z;
    mm[x][y] = z;
    mm[y][x] = z;
    if (1.0 * (mn[x] + mn[y]) / z > sol) sol = 1.0 * (mn[x] + mn[y]) / z;
  }
  cout.precision(11);
  cout << fixed;
  cout << sol;
  return 0;
}
