implements max(f*h_i, MAX)