#include <bits/stdc++.h>
using namespace std;
const int INF = INT_MAX;
const long long INFL = LLONG_MAX;
int N, M, X[1000], a, b, c;
int main() {
  ios_base::sync_with_stdio(0);
  cout.precision(15);
  cin >> N >> M;
  for (int(i) = 1; (i) <= (N); (i)++) cin >> X[i];
  long double answer = 0;
  for (int(i) = 1; (i) <= (M); (i)++) {
    cin >> a >> b >> c;
    answer = max(answer, (long double)(X[a] + X[b]) / c);
  }
  cout << answer << endl;
}
