#include <bits/stdc++.h>
using namespace std;
int dp[513];
int n, m;
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &dp[i + 1]);
  }
  double best = 0;
  for (int i = 0; i < m; ++i) {
    int x, y, z;
    scanf("%d %d %d", &x, &y, &z);
    best = max(best, ((double)dp[x] + dp[y]) / z);
  }
  printf("%.9lf", best);
  return 0;
}
