#include #include #include #include using namespace std; using ll = long long; using tu = tuple; int main(void){ int n, c, v; cin >> n >> c >> v; vector s(v), t(v), y(v), m(v); for(auto&x:s) cin >> x, x--; for(auto&x:t) cin >> x, x--; for(auto&x:y) cin >> x; for(auto&x:m) cin >> x; vector> to(n); for(int i=0; i(c+1, 1e9)); dp[0][0]=0; for(int i=0; ic) continue; dp[v][nc]=min(dp[v][nc], dp[i][j]+dt); } } } int ans=*min_element(begin(dp[n-1]), end(dp[n-1])); cout << (ans==1e9?-1:ans) << endl; return 0; }