#include <bits/stdc++.h>
using namespace std;
const int INF = (-1u) / 2;
const long long int INF2 = (-1ull) / 2;
int a, b, i, j, k, n, m, timer = 0, road[550][550], usedr[550][550], vk[550];
int c[550], fl = 0, a2, a3 = -1000000, used[550] = {0}, p;
vector<pair<int, int> > g[550];
vector<int> vec;
double cnt = 0;
int main() {
  scanf("%d%d", &n, &m);
  for (i = 1; i <= n; i++) {
    scanf("%d", &c[i]);
  }
  for (i = 0; i < m; i++) {
    scanf("%d%d%d", &a, &b, &j);
    cnt = max(cnt, ((c[a] + c[b]) * 1.0) / (j * 1.0));
  }
  printf("%.15lf\n", cnt);
  return 0;
}
