using System; using System.Collections.Generic; using System.Collections; using System.Collections.Specialized; using System.Linq; using System.Text; using System.IO; using System.Reflection; using static System.Math; using System.Numerics; using System.Threading; using System.Runtime.CompilerServices; static class Program{ const int mod=(int)1e9+7; static void Main(){ Sc sc=new Sc(); var s=sc.Ia; int n=s[0],m=s[1]; if(s[2]<=15){ var li=new List>[n+1]; for(int i=1;i<=n;i++){li[i]=new List>();} var wf=new int[n+1][]; for(int i=1;i<=n;i++){ wf[i]=new int[n+1]; for(int j=1;j<=n;j++){ if(i!=j){wf[i][j]=mod;} } } for(int i=0;i0;k=(k-1)&p){dp[i][j]=Min(dp[i][j],dp[k][j]+dp[i-k][j]);} } for(int j = 1;j<=n;j++) { for(int k = 1;k<=n;k++) { dp[i][j]=Min(dp[i][j],dp[i][k]+wf[j][k]); } } } dp[g-1][0]=mod; Console.WriteLine("{0}",dp[g-1].Min()); } else{ var h=new int[m][]; for(int i=0;iu[2]-v[2]); var b=new int[n+1]; for(int i = 0;i>1)&0x55555555; z=(z&0x33333333)+((z>>2)&0x33333333); return ((z+(z>>4)&0xF0F0F0F)*0x1010101)>>24; } } } public class Uf{ private int[] arr,hi; public int all; public Uf(int n){ arr=new int[n]; hi=new int[n]; all=n; for(int i=0;i(int n,Func f){var a=new T[n];for(int i=0;i(int n,Func f){var a=new T[n];for(int i=0;i(int n,Func f){var a=new T[n];for(int i=0;i(int n,Func f){var a=new T[n];for(int i=0;i(){var s=Console.ReadLine().Split();return (Ct(s[0]),Ct(s[1]));} public (T,T,T) Tp3(){var s=Console.ReadLine().Split();return (Ct(s[0]),Ct(s[1]),Ct(s[2]));} private T Ct(string s){return (T)Convert.ChangeType(s,typeof(T));} }