#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
int dr[] = {1, 1, 0, -1, -1, 0};
int dc[] = {-1, 0, 1, 1, 0, -1};
int main() {
  int n, m;
  cin >> n >> m;
  int val[501];
  for (int i = 0; i < n; i++) cin >> val[i];
  double ans = 0.0;
  for (int i = 0; i < m; i++) {
    int a, b, c;
    cin >> a >> b >> c;
    a--;
    b--;
    double x = ((double)val[a] + (double)val[b]) / (double)c;
    ans = max(ans, x);
  }
  printf("%.9lf\n", ans);
  return 0;
}
