#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/STACK:16777216")
struct tube {
  int v, o;
};
int n, m;
bool a[50][50];
bool used[50];
tube b[50];
int ans;
bool comp(tube a, tube b) { return a.v > b.v; }
void bfs(int start_node) {
  used[start_node] = true;
  ans += 1;
  for (int i = 0; i < n; i++) {
    if (!used[i])
      if (a[start_node][i]) {
        bfs(i);
      }
  }
}
int main() {
  double a[500][500];
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) a[i][j] = 0;
  int b[500];
  for (int i = 0; i < n; i++) cin >> b[i];
  for (int i = 0; i < m; i++) {
    int l, r;
    double v;
    cin >> l >> r >> v;
    l--;
    r--;
    a[l][r] = v;
    a[r][l] = v;
  }
  double minWay = 0;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) {
      if (a[i][j] > 0) {
        minWay = max(minWay, (b[i] + b[j]) / a[i][j]);
      }
    }
  printf("%.10f\n", minWay);
  return 0;
}
