you give simple weight connect undirected graph consist n vertex m edgesA path graph length k sequence k1 vertice v_1 v_2 dot v_k1 1 le le k edge v_i v_i1 present graph a path vertex v vertex v_1v Note edge vertex allow include path multiple timesthe weight path total weight edge itfor 1 q consider path vertex 1 length maximum weight what sum weight q pathsansw large print modulo 1097