#include <bits/stdc++.h>
using namespace std;
template <class T>
T gcd(T a, T b) {
  return (b != 0 ? gcd<T>(b, a % b) : a);
}
template <class T>
T lcm(T a, T b) {
  return (a / gcd<T>(a, b) * b);
}
long long pwr(long long base, long long p) {
  long long ans = 1;
  while (p) {
    if (p & 1) ans = (ans * base) % (1000000007LL);
    base = (base * base) % (1000000007LL);
    p >>= 1;
  }
  return ans;
}
long long modInv(long long n, long long mod) { return pwr(n, mod - 2); }
int bitCount(int n) {
  int c = 0;
  while (n) {
    c++;
    n &= n - 1;
  }
  return c;
}
int main() {
  double n, m, cost;
  ;
  int i, a, b;
  cin >> n >> m;
  int ver[100000];
  for (i = 1; i < n + 1; i++) {
    scanf("%d", &ver[i]);
  }
  double ans = 0;
  for (i = 0; i < m; i++) {
    cin >> a >> b >> cost;
    ans = max(ans, (ver[a] + ver[b]) / cost);
  }
  printf("%.12lf\n", ans);
  return 0;
}
