#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int SIZE = 1e6 + 10;
int a[SIZE];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < (n); ++i) scanf("%d", &(a[i + 1]));
  double an = 0;
  for (int i = 0; i < (m); ++i) {
    int x, y, v;
    scanf("%d%d%d", &x, &y, &v);
    an = max(an, (a[x] + a[y]) * 1. / v);
  }
  printf("%.12f\n", an);
  return 0;
}
