4703: P8802 [蓝桥杯 2022 国 B] 出差
          Memory Limit:128 MB
          Time Limit:1.000 S
         
      
      
        
          Judge Style:Text Compare
          Creator:
      
      
          Submit:0
          Solved:0
      
Description

Input

Output

Sample Input Copy
4 4
5 7 3 4
1 2 4
1 3 5
2 4 3
3 4 5Sample Output Copy
13HINT
