#include <bits/stdc++.h>
using namespace std;
long long power(long long a, long long b, long long modi) {
  long long res = 1;
  while (b) {
    if (b % 2) res = (res * a) % modi;
    b /= 2;
    a = (a * a) % modi;
  }
  return res;
}
int dirx[] = {-1, -1, -1, 0, 0, 1, 1, 1};
int diry[] = {-1, 0, 1, -1, 1, -1, 0, 1};
int dx[] = {-1, 1, 0, 0};
int dy[] = {0, 0, -1, 1};
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, m;
  cin >> n >> m;
  double ans = 0;
  int u, v, c;
  int a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < m; i++) {
    cin >> u >> v >> c;
    ans = max(ans, ((a[u - 1] + a[v - 1]) / (double(c))));
  }
  cout << setprecision(10) << ans;
  return 0;
}
