#include #include #include #include #include #include #include #include #include #include #include #include #define INF 1000000000 using namespace std; typedef long long int ll; typedef pair P; struct edge{ int from, cost, time; }; int main() { int n, c, v; scanf("%d", &n); scanf("%d", &c); scanf("%d", &v); int s[1500], t[1500], y[1500], m[1500]; for(int i=0; i e[50]; for(int i=0; idp[x][k-y0]+t0){ dp[i][k]=dp[x][k-y0]+t0; } } } } int ans=INF; for(int k=0; k<=c; k++){ if(ans>dp[n-1][k]) ans=dp[n-1][k]; } if(ans==INF){ printf("%d\n", -1); }else{ printf("%d\n", ans); } return 0; }