#include <bits/stdc++.h>
using namespace std;
using namespace std;
long long int ans = 0;
long long int gcd(long long int a, long long int b) {
  if (b == 0) return a;
  ans += a / b;
  return gcd(b, a % b);
}
long long int mod = 1000000007;
long long int fact[21];
void factorial() {
  fact[0] = 1;
  fact[1] = 1;
  for (int i = 2; i < 21; ++i) fact[i] = (fact[i - 1] * i);
  return;
}
long long int binpower(long long int a, long long int b) {
  long long int ans = 1;
  while (b > 0) {
    if (b & 1) ans = (ans * a) % mod;
    a = (a * a) % mod;
    b >>= 1;
  }
  return ans;
}
bool isPrime(int n) {
  for (int i = 2; i * i <= n; ++i) {
    if (n % i == 0) return false;
  }
  return true;
}
long long int gprime[10000001];
void grsieve() {
  gprime[1] = 1;
  gprime[0] = 1;
  for (long long int i = 2; i < 10000001; ++i) {
    if (gprime[i] == 0) {
      for (long long int j = i; j < 10000001; j += i) gprime[j] = i;
    }
  }
}
const int maxn = 1e6 + 1;
bool checkprimes[maxn];
vector<long long int> primes;
void primechecker() {
  for (long long int i = 2; i < maxn; ++i) {
    if (checkprimes[i] == false) {
      primes.push_back(i);
      for (long long int j = i; j < maxn; j += i) {
        checkprimes[j] = true;
      }
    }
  }
}
long long int C(int u, int v) {
  long long int c = (fact[v] * fact[u - v]) % mod;
  long long int in = binpower(c, mod - 2);
  long long int res = (in * fact[u]) % mod;
  return res;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int test = 1;
  while (test--) {
    int n, m;
    cin >> n >> m;
    int x[n];
    for (int i = 0; i < n; ++i) cin >> x[i];
    int a, b, c;
    double ans = 0.0;
    for (int i = 0; i < m; ++i) {
      cin >> a >> b >> c;
      a--;
      b--;
      ans = max(ans, (1.0 * (x[a] + x[b])) / c);
    }
    cout << fixed << setprecision(15) << ans;
  }
  return 0;
}
