#include <bits/stdc++.h>
using namespace std;
int N, M, ar[610];
int main() {
  scanf(" %d %d", &N, &M);
  for (int i = 1; i <= N; i++) scanf(" %d", &ar[i]);
  int a, b, c;
  double ans = 0;
  for (int i = 1; i <= M; i++) {
    scanf(" %d %d %d", &a, &b, &c);
    ans = max(ans, (double)(ar[a] + ar[b]) / c);
  }
  printf("%.9lf\n", ans);
  return 0;
}
