#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > adj[(505)];
int values[(505)];
int main() {
  int N, M;
  int u, v, c;
  scanf("%d %d", &N, &M);
  double maxx = 0.0;
  for (int i = 1; i <= N; i++) {
    scanf("%d", &values[i]);
  }
  for (int i = 0; i < M; i++) {
    scanf("%d %d %d", &u, &v, &c);
    adj[u].push_back(pair<int, int>(v, c));
    ;
    adj[v].push_back(pair<int, int>(u, c));
    ;
  }
  for (int i = 1; i <= N; i++) {
    for (int j = 0; j < ((int)((adj[i]).size())); j++) {
      u = i;
      v = adj[u][j].first;
      maxx = max(maxx, (values[u] + values[v]) * 1.0 / adj[i][j].second);
    }
  }
  printf("%.9lf\n", maxx);
  return 0;
}
