#include <cstdio>
#include <algorithm>
using namespace std;
int n, m, a, b, c, x[1100];
int main() {
scanf("%d%d", &n, &m);
for (int i = 1; i <= n; i++) scanf("%d", &x[i]);
double ans = 0;
for (int i = 1; i <= m; i++) {
scanf("%d%d%d", &a, &b, &c);
ans = max(ans, 1.0 * (x[a] + x[b]) / c);
}
printf("%.15lf\n", ans);
}
I2luY2x1ZGUgPGNzdGRpbz4KI2luY2x1ZGUgPGFsZ29yaXRobT4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmludCBuLCBtLCBhLCBiLCBjLCB4WzExMDBdOwoKaW50IG1haW4oKSB7CglzY2FuZigiJWQlZCIsICZuLCAmbSk7Cglmb3IgKGludCBpID0gMTsgaSA8PSBuOyBpKyspCXNjYW5mKCIlZCIsICZ4W2ldKTsKCWRvdWJsZSBhbnMgPSAwOwoJZm9yIChpbnQgaSA9IDE7IGkgPD0gbTsgaSsrKSB7CgkJc2NhbmYoIiVkJWQlZCIsICZhLCAmYiwgJmMpOwoJCWFucyA9IG1heChhbnMsIDEuMCAqICh4W2FdICsgeFtiXSkgLyBjKTsKCX0KCXByaW50ZigiJS4xNWxmXG4iLCBhbnMpOwp9