#include <bits/stdc++.h>
using namespace std;
int main() {
  int arr[505][505];
  memset(arr, -1, sizeof arr);
  int n, m;
  cin >> n >> m;
  vector<int> x(n);
  for (int i = 0; i < n; ++i) scanf("%d", &x[i]);
  for (int i = 0; i < m; ++i) {
    int a, b, c;
    scanf("%d %d %d", &a, &b, &c);
    --a, --b;
    arr[a][b] = c;
    arr[b][a] = c;
  }
  if (n == 1) {
    cout << 0 << endl;
    return 0;
  }
  double res = 0;
  for (int i = 0; i < n; ++i)
    for (int j = i + 1; j < n; ++j)
      if (arr[i][j] != -1) res = max(res, (0.0 + x[i] + x[j]) / arr[i][j]);
  cout << setprecision(18);
  cout << res << endl;
  return 0;
}
