The first line contains two integers nnn and T(2≤n,T≤105)T (2 \leq n, T \leq 10^5)T(2≤n,T≤105), representing the number of cities and the total number of days.
The next n+1n+1n+1 lines (from 222nd to (n+2)(n+2)(n+2)-th) each contain four integers ui,vi,ai,bi(1≤ui,vi≤n,0≤ai,bi≤108)u_i, v_i, a_i, b_i(1 \leq u_i, v_i \leq n, 0 \leq a_i,b_i \leq 10^8)ui,vi,ai,bi(1≤ui,vi≤n,0≤ai,bi≤108), representing a channel between cities uiu_iui and viv_ivi. The cost of opening this channel on the jjj-th day is ai×j+bia_i \times j + b_iai×j+bi.
It is guaranteed that there are no self-loops, but there may be multiple edges between the same pair of vertices.