#include <bits/stdc++.h>
using namespace std;
int n, m;
int dot[510];
inline long double max(long double a, long double b) { return a > b ? a : b; }
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) {
    scanf("%d", dot + i);
  }
  double ans = 0.0;
  for (int i = 1; i <= m; i++) {
    int x, y, z;
    scanf("%d%d%d", &x, &y, &z);
    if (z > 0) {
      ans = max(ans, (long double)(dot[x] + dot[y]) / z);
    }
  }
  cout << setiosflags(ios::fixed) << setprecision(10) << ans << endl;
  return 0;
}
