#include <bits/stdc++.h>
using namespace std;
int node[1000];
int e[1000][1000];
int main() {
  int n, m;
  cin >> n >> m;
  for (long long i = 0; i < n; i++) cin >> node[i];
  for (long long i = 0; i < m; i++) {
    int x, y, z;
    cin >> x >> y >> z;
    x--;
    y--;
    e[x][y] = e[y][x] = z;
  }
  double res = 0;
  for (long long i = 0; i < n; i++)
    for (long long j = 0; j < n; j++) {
      if (i != j && e[i][j]) {
        if (res < (node[i] + node[j] + 0.0) / (e[i][j]))
          res = (node[i] + node[j] + 0.0) / (e[i][j]);
      }
    }
  cout.precision(9);
  cout << fixed << res << endl;
}
